Hi -- The Prototype documentation suggests the following to get form values by name: <code> $F( $( formID )[fieldName] ) </code> However the above does not work if I have multiple checkboxes or radio buttons with the same name, since in that case $( formID )[fieldName] returns a NodeList. I understand the suggestion of using Form.getInputs() however I prefer to use field names instead so that I don''t have to worry about what type of input a particular field is. So, I found I can solve this problem by changing Form.Element.Methods.getValue to support taking a NodeList parameter as well as a single argument, like so: <code> var old$F = Form.Element.Methods.getValue; /* Handles multiple-valued elements for the case where form[fieldName] * returns multiple elements (i.e. checkboxes and radio buttons */ Form.Element.Methods.getValue = function(element) { if( element instanceof NodeList ) return $A( element ).collect( function(e) { return $F(e); } ).compact(); else return old$F( element ); }; var $F = Form.Element.Methods.getValue; </code> I don''t purport to know anything about Prototype but this seems to work without breaking backwards compatibility. I also added a new utility method to get a field value given a form and a field name: <code> Form.Element.Methods.getValueByName = function(form, fieldName) { if( form instanceof String ) form = $(form); return $F( form[fieldName] ); }; var $FN = Form.Element.Methods.getValueByName; </code> Any thoughts on why this might be a _bad_ idea? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---