samedi 25 avril 2015

Is there a reliable jQuery plugin hat can repopulate the form from json values?


I have a form with 180 form fields. On a button click I need to replace current form fields values with the ones from json var. Instead of doing

on some element click 
$.each(getData, function(index, value) {

    check if select
        add new value, trigger refresh
    check if radio
       add new value, trigger refresh
    check if textarea
       add new value, trigger refresh
...

is there already a plugin that does something like this? I browsed and came up with very old scripts like populate or loadJSON wich are not supported anymore.

My biggest issue is that this is a multi level json array and the field names are like

<input name="form_field[one]"...
<input name="form_field[one][two][three]"...
<input name="form_field[one][two]"...

any help is appreciated.


Aucun commentaire:

Enregistrer un commentaire