Hi guys...here it is an updated version of my script "prototype form deserializer". It solves some bugs people all around has found using it. Thanks to all.
I like you deserialization script a lot. It's easy to add JSON deserialization, here is deserializeJSON method:
Object.extend(Form, { deserializeJSON: function(form, data) { form = $(form); form.reset();
var json = data.evalJSON(); for (var i in json) { var id = i; var value = json[i]; if (id != form.id && value != 'undefined' && value != null) Form.Element.deserialize(form, id, value); }
4 Comments:
Any plans on a mootools version?
Yes...In the near future I'd like to refactoring this simple script to make a sort of "cross framework" version of it. Stay tuned!
That would be great! I could really use a mootools version soon though :(
Thanks for a great script!
I like you deserialization script a lot. It's easy to add JSON deserialization, here is deserializeJSON method:
Object.extend(Form, {
deserializeJSON: function(form, data) {
form = $(form);
form.reset();
var json = data.evalJSON();
for (var i in json) {
var id = i;
var value = json[i];
if (id != form.id && value != 'undefined' && value != null)
Form.Element.deserialize(form, id, value);
}
}
});
Post a Comment
Links to this post:
Create a Link
<< Home