simmstein / unserialize-to-form Goto Github PK
View Code? Open in Web Editor NEWThis project forked from nilbus/unserialize-to-form
Unserialize data back into DOM forms
License: Other
This project forked from nilbus/unserialize-to-form
Unserialize data back into DOM forms
License: Other
jQuery Unserialize (to) Form ---------------------------- Version 1.0.8 Simple jQuery plugin to unserialize data back into forms. Usage: var s = $("form").serialize(); // save form settings. $("form").unserializeForm(s); // restore form settings The serialized form data could be saved in a session, perhaps in HTML5 sessionStorage. Note that saving the serialized data to a cookie is troublesome as not all browsers implement the same cookie string lengths, so sessionStorage or a SQL db is recommended. Alternate Usage: var cb = function(key, value, [element]) { return true; // or false } var s = $("form").serialize(); $("form").unserializeForm(s, { 'callback' : cb, 'override-values' : false }); callback (optional): The above callback is given the element name and value, allowing you to build dynamic forms via callback. If you return false, unserializeForm will try to find and set the DOM element, otherwise, (on true) it assumes you've handled that attribute and moves onto the next. The callback will be passed the key and value and, if found, the DOM object it will use should you return false. If the DOM object is not found, the third parameter will be the empty array jQuery returns when it cannot find an element. override-values (optional, default is false): Controls whether elements already set (e.g. an input tag with a non-zero length value) will be touched by the unserializer. Does not apply to radio fields or checkboxes. If you have a use case for radio fields or checkboxes, please file an issue at https://github.com/cthielen/unserialize-to-form/issues/ . Also note this option does not apply to a callback, i.e. a callback would still have the opportunity to override a value even if this option is set to false. It is up to you as the callback author to enforce the behavior you wish. Known issues: * Input element arrays are not cleared before being unserialized, resulting in the unserialized values _and_ whatever was already set to be set. Special thanks / Contributors: Anton Thiago Macedo genellern Edward Anderson hoka Scott Kirkland Joshua Weinstein Gary Green
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.