Test jQuery Form Deserialization Plugin version 0.35
* This plugin sets the values of form element variables from a JSON array/hash
* This is the reverse process of Mark Constable's serialize function
* It is expected to be used as a call back for an ajax call that retrieves the form data
* @param data : array or hash containing name,value pairs for elements in the form
*
* Examples
*
* 1. Deserialize from an array
* $('#form-id').deserialize([{'name':'firstname','value':'John'},{'name':'lastname','value':'Resig'}]);
*
* 2. Deserialize from a hash(object)
* $('#form-id').deserialize({'firstname':'John','lastname':'Resig'});
*
* 3. Deserialize multiple options for select/radio/checkbox
* $('#form-id').deserialize({'toppings':['capsicum','mushroom','extra_cheese'],'size':'medium'})
* which will set the corresponding select/radio/checkbox options for toppings
*
* 4. Deserialize multiple options for select/radio/checkbox, and with isPHPnaming option set to true
* $('#form-id').deserialize({'toppings':['capsicum','mushroom','extra_cheese'],'size':'medium'},{'isPHPnaming':true})
* which will set the corresponding select/radio/checkbox options for toppings, but will ignore variable names ending with []
Modified nested if statements with switch as suggested by Kenton Simpson
0.3 Jul 26 2006
Optimized code to reduce number of DOM queries, forced reset of variables not found in JSON data as illustrated by example 3 above (now available as configurable option 'overwrite')
0.31 Aug 06 2006
Disabled deserialization for buttons if value is not found in JSON
0.32 Sep 07 2006
Modified to support multiple selection. Thanks to Philip Floetotto for the suggestion and code. Added example for loading JSON by ajax.
0.33 Oct 12 2006
Modified to fix bug and patch identified by Kenton Simpson. In IE6, typeof x != undefined is true when x=null !!! One more rant against IE.
0.34 Jan 27 2007
Added config hash as second parameter. In config hash, one can set the key isPHPnaming to true for the plugin to handle php style naming of form variables for multi-select inputs ie with [] at the end of the name, as requested by John Snook (http://www.nabble.com/Deserialize-plugin-and-PHP-mulitiselect-format-problem-tf3124015.html). Check example 5 above
0.35 Jan 29 2007
Incorporated changes made by Florian Fackler - Added overwrite option in config, whose default value is true. If set to false, will only set variables defined in the JSON hash, and ignore others. If true, all options not defined in HASH are reset