How to set values using jquery in the form below json -
i have form generator json data
{ "10" : { "custom" : null, "custom2" : null, "label" : "sublimacja", "max" : "", "min" : "", "required" : "0", "tooltip" : "field7", "type" : "dropdown", "validation" : "", "value" : "sublimacja 205g" }, "11" : { "custom" : null, "custom2" : null, "label" : "druk+uv", "max" : "", "min" : "", "required" : "0", "tooltip" : "field8", "type" : "dropdown", "validation" : "", "value" : "kalka" }, "12" : { "custom" : null, "custom2" : null, "label" : "rodzaj+wyko%c5%84czenia", "max" : "", "min" : "", "required" : "0", "tooltip" : "field9", "type" : "dropdown", "validation" : "", "value" : "cięcie wymiaru" }, "13" : { "custom" : null, "custom2" : null, "label" : "rodzaj+wysy%c5%82ki", "max" : "", "min" : "", "required" : "0", "tooltip" : "field10", "type" : "dropdown", "validation" : "", "value" : "ups standard" }, "14" : { "custom" : null, "custom2" : null, "label" : "adres+wysy%c5%82ki", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field11", "type" : "para", "validation" : "", "value" : "" }, "15" : { "custom" : null, "custom2" : null, "label" : "uwagi+dodatkowe", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field12", "type" : "para", "validation" : "", "value" : "" }, "16" : { "custom" : null, "custom2" : null, "label" : "divider", "max" : null, "min" : null, "required" : null, "tooltip" : null, "type" : "divider", "validation" : "divider", "value" : "plik 1" }, "17" : { "custom" : null, "custom2" : null, "label" : "nazwa+pliku+1", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field14", "type" : "text", "validation" : "", "value" : "" }, "18" : { "custom" : null, "custom2" : null, "label" : "ilo%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field15", "type" : "text", "validation" : "", "value" : "" }, "19" : { "custom" : null, "custom2" : null, "label" : "wysoko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field16", "type" : "text", "validation" : "", "value" : "" }, "2" : { "custom" : null, "custom2" : null, "label" : "", "max" : null, "min" : null, "required" : null, "tooltip" : null, "type" : null, "validation" : null, "value" : "" }, "20" : { "custom" : null, "custom2" : null, "label" : "szeroko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field17", "type" : "text", "validation" : "", "value" : "" }, "21" : { "custom" : null, "custom2" : null, "label" : "divider", "max" : null, "min" : null, "required" : null, "tooltip" : null, "type" : "divider", "validation" : "divider", "value" : "plik 2" }, "22" : { "custom" : null, "custom2" : null, "label" : "nazwa+pliku+2", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field19", "type" : "text", "validation" : "", "value" : "" }, "23" : { "custom" : null, "custom2" : null, "label" : "ilo%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field20", "type" : "text", "validation" : "", "value" : "" }, "24" : { "custom" : null, "custom2" : null, "label" : "szeroko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field21", "type" : "text", "validation" : "", "value" : "" }, "25" : { "custom" : null, "custom2" : null, "label" : "wysoko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field22", "type" : "text", "validation" : "", "value" : "" }, "26" : { "custom" : null, "custom2" : null, "label" : "divider", "max" : null, "min" : null, "required" : null, "tooltip" : null, "type" : "divider", "validation" : "divider", "value" : "plik 3" }, "27" : { "custom" : null, "custom2" : null, "label" : "nazwa+pliku+3", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field24", "type" : "text", "validation" : "", "value" : "" }, "28" : { "custom" : null, "custom2" : null, "label" : "ilo%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field25", "type" : "text", "validation" : "", "value" : "" }, "29" : { "custom" : null, "custom2" : null, "label" : "szeroko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field26", "type" : "text", "validation" : "", "value" : "" }, "3" : { "custom" : null, "custom2" : null, "label" : "nazwa+firmy", "max" : "60", "min" : "0", "required" : "1", "tooltip" : "field0", "type" : "text", "validation" : "", "value" : "fdfdf" }, "30" : { "custom" : null, "custom2" : null, "label" : "wysoko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field27", "type" : "text", "validation" : "", "value" : "" }, "31" : { "custom" : null, "custom2" : null, "label" : "divider", "max" : null, "min" : null, "required" : null, "tooltip" : null, "type" : "divider", "validation" : "divider", "value" : "plik 4" }, "32" : { "custom" : null, "custom2" : null, "label" : "nazwa+pliku+4", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field29", "type" : "text", "validation" : "", "value" : "" }, "33" : { "custom" : null, "custom2" : null, "label" : "ilo%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field30", "type" : "text", "validation" : "", "value" : "" }, "34" : { "custom" : null, "custom2" : null, "label" : "szeroko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field31", "type" : "text", "validation" : "", "value" : "" }, "35" : { "custom" : null, "custom2" : null, "label" : "wysoko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field32", "type" : "text", "validation" : "", "value" : "" }, "36" : { "custom" : null, "custom2" : null, "label" : "divider", "max" : null, "min" : null, "required" : null, "tooltip" : null, "type" : "divider", "validation" : "divider", "value" : "plik 5" }, "37" : { "custom" : null, "custom2" : null, "label" : "nazwa+pliku+5", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field34", "type" : "text", "validation" : "", "value" : "" }, "38" : { "custom" : null, "custom2" : null, "label" : "ilo%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field35", "type" : "text", "validation" : "", "value" : "" }, "39" : { "custom" : null, "custom2" : null, "label" : "szeroko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field36", "type" : "text", "validation" : "", "value" : "" }, "4" : { "custom" : null, "custom2" : null, "label" : "nip", "max" : "10", "min" : "10", "required" : "0", "tooltip" : "field1", "type" : "text", "validation" : "integers", "value" : "1234567890" }, "40" : { "custom" : null, "custom2" : null, "label" : "wysoko%c5%9b%c4%87", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field37", "type" : "text", "validation" : "", "value" : "" }, "41" : { "custom" : null, "custom2" : null, "label" : "plik", "max" : "", "min" : "", "required" : "0", "tooltip" : "field38", "type" : "upload", "validation" : "file", "value" : "0" }, "42" : { "custom" : null, "custom2" : null, "label" : "title", "max" : null, "min" : null, "required" : null, "tooltip" : null, "type" : null, "validation" : null, "value" : "zamówienie" }, "5" : { "custom" : null, "custom2" : null, "label" : "imi%c4%99", "max" : "60", "min" : "0", "required" : "1", "tooltip" : "field2", "type" : "text", "validation" : "", "value" : "dfdf" }, "6" : { "custom" : null, "custom2" : null, "label" : "nazwisko", "max" : "60", "min" : "0", "required" : "1", "tooltip" : "field3", "type" : "text", "validation" : "", "value" : "dfdff" }, "7" : { "custom" : "autoreply", "custom2" : "replyto", "label" : "email", "max" : "", "min" : "", "required" : "1", "tooltip" : "field4", "type" : "email", "validation" : "email", "value" : "kasper@dolczewski.eu" }, "8" : { "custom" : null, "custom2" : null, "label" : "rodzaj+zam%c3%b3wienia", "max" : "", "min" : "", "required" : "0", "tooltip" : "field5", "type" : "dropdown", "validation" : "", "value" : "druk sublimacyjny transferowy" }, "9" : { "custom" : null, "custom2" : null, "label" : "inne", "max" : "60", "min" : "0", "required" : "0", "tooltip" : "field6", "type" : "text", "validation" : "", "value" : "" } }
and form has input files name
<input type="text" name="nazwa firmy_text__1_0_60_field0" ng-style="{width: el.wid}" style="width: 100%;"> <span class="inst ng-binding" ng-style="{ fontsize: con[0].ifs+"px", color: con[0].ifc }" style=""></span>
what easiest way set values form using jquery or maybe plugin because name of each field generated dynamically based on inputted json data can name_fieldtyoe_max_min without min , max
is there way check bit of name of field compare json data , set value?
you can use following way set value of input field if know partial name
$('input[name^="name_fieldtyoe"]').val('this value');
the above line set value input field has name staring name_fieldtyoe
.
see jquery documentation more information
Comments
Post a Comment