>Overwriting core methods is fine as long as you don't change the >contract/behaviour of that method. Just think of a site that uses the >form plugin and a different that relies on the standarf val() behaviour. >An extension that can handle arrays to manipulate selects/checkboxes >would be fine from my perspective.
After looking at the val() function, it might not be a good idea to overwrite it. My guess is some people use the val() function like to see if a checkbox was checked: $("[EMAIL PROTECTED]'myCheckbox']:checked").val(); If this element was checked, it would give you a single value. My concept of retrieving form values is a little different, as it's designed to give you a consistent method to access any type of form field (so that if you change the form field type--from a radio element to a checkbox--you don't have to change your code. So, with my concept, you really want to do just this: $("[EMAIL PROTECTED]'myCheckbox']").getValue(); >>> 2) If you use an array to set the value on a text field, what value >>> should >>> we put in? Only the first position? Do we concatenate the array and >>> use that >>> value? >> Good question! :-) >I can't imagine a case where I'd have one or more text inputs and an >array of strings and want to map one to the other. One thing I learned from developing qForms--some people do some really bizarre things with HTML forms. :) >>> I'd probably start w/the methods that manipulate select elements (moving >>> option elements around, transferring them to another select element, >>> doing >>> n-related select boxes, etc.) >> >> Yes. Sam Collett has some great option utilities as well, and they're >> already jQuery plugins. That would be worth looking into. >By merging those plugins/efforts a lot of duplication could be avoided. >Modify the form plugin to handle all the generic manipulation stuff and >provide plugins on top of that to do special stuff like what Dan mentioned. I agree. I'd like to see the my code eventually rolled into the Form plug-in (because I see being able to get/set a form field a very basic functionality of a form plug-in) and then roll up additional functionality that's closely tied to the Form Plug-in in another Plug-in that extends the Form Plug-in. Quite frankly Jörn, I see your validation plug-in very closely tied into the Form Plug-in. I'd imagine a lot of people use both plug-ins in their pages. -Dan