[jQuery] Form deserialize plugin
I've made a plugin for populating a form via data received as JSON from an AJAX call.
<pre> * 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
*
* <b>Examples</b>
*
* 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
</pre>
<a href="http://www.reach1to1.com/sandbox/jquery/testform.html">http://www.reach1to1.com/sandbox/jquery/testform.html</a>
Would appreciate feedback, and if someone could test in browsers other than FF and IE
Regards
Ashutosh<br clear="all">
--
Reach1to1 Communications
<a href="http://www.reach1to1.com">http://www.reach1to1.com</a>
<a href="mailto:bijoor@reach1to1.com">bijoor@reach1to1.com</a>
98201-94408
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/