> These last two items may cause issues for some but to me they are far > more intuitive than what we currently have and I think the discussions > earlier this week were leading in this direction. Currently, the form > plugin's "serialize" method returns an array of objects and core's > "serialize" method returns a '&' delimited string.
I'd like you to consider the following scenario: A form is to be submitted via ajaxForm. I wanto to validate the form on the client-side first. For this, I want to use a plugin that allows me to put the validation rules into the markup (something like this: http://fuzz.bassistance.de/jQueryFormValidation/validateTest.html). If I try to use the form's plugin pre-callback, I only get the serialized data, without access to the DOM elements. My idea so far: Add more stuff to the array per element, resulting in something like this: [{ name: "firstname", value: "Peter", submit: true, element: domInputElement }, { name: "agree", value: "on", submit: false, element: domCheckBoxElement }] The serialize method would then convert all entries with a submit value true into the query string. An idea to boost the performance of the formToArray method while retaining order: $('*', context).filter(':input')... That would start with all elements within the form to guarantee order, and remove all invalid elements (divs etc.) before iterating and scanning them. An alternative to the above extended array/objects would be to just pass the jQuery object that contains all form elements as a second parameter to the pre-callback. The validation could the access all form elements and use the validation rules within the elements to check the entries in the array. > On a final note, I've updated the demo page to include a link to run > the unit tests. If some of you Safari users could run the unit tests > I would appreciate it. > > Demo page: http://malsup.com/jquery/form/ > Unit test: http://malsup.com/jquery/form/test.html Great to see the testrunner in action for something else then jQuery itself. The code looks like you just wrote that directly into the html page, instead of generating it, right? That's something that might be preferable for jQuery, too. -- Jörn -- GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist! NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/