Clever!  I will try that.  Another approach that might work for some is to
serialize the form data into a hash.  Then you should have the values for
each form control indexed by their name.

var h = $('formId').serialize( true ) ;

Then, for a form control with a name of 'name' you can do:

if (h{'name'} == 'valueIcareAbout') ...

On Fri, Apr 30, 2010 at 1:25 PM, Jonathan Rosenberg <j...@tabbysplace.org>wrote:

>  I think this might work.  You could wrap it up into a function, of
> course, with name as a parameter.
>
>
>
>                     
> $$(‘input[type=”radio”][name=”whatever”]’).find(function(radio)
>
>                { return radio.checked; }).value;
>
>
>
> --
> Jonathan Rosenberg
> Founder & Executive Director, Tabby's Place
> http://www.tabbysplace.org/
>
>
>
>
>
> *From:* prototype-scriptaculous@googlegroups.com [mailto:
> prototype-scriptacul...@googlegroups.com] *On Behalf Of *Shane McCarron
> *Sent:* Friday, April 30, 2010 1:32 PM
> *To:* prototype-scriptaculous@googlegroups.com
> *Subject:* [Proto-Scripty] Getting the value of a form field
>
>
>
> I am sure this is just ignorance on my part, but...
>
> I would really like to $F('formField') to get the value of whatever field I
> am interested in.  However, it seems formField needs to be the field's ID,
> not its Name.  That's cool, except when I have Radio Buttons or Check
> Boxes.  You aren't allowed to have multiple elements with the same ID and
> still be valid.  What's the right way to do this?
>
> --
> Shane McCarron
> halindr...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculous%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To post to this group, send email to
> prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to
> prototype-scriptaculous+unsubscr...@googlegroups.com<prototype-scriptaculous%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>



-- 
Shane McCarron
halindr...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to