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 <[email protected]>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:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Shane McCarron
> *Sent:* Friday, April 30, 2010 1:32 PM
> *To:* [email protected]
> *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
> [email protected]
>
> --
> 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
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<prototype-scriptaculous%[email protected]>
> .
> 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
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<prototype-scriptaculous%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
>
--
Shane McCarron
[email protected]
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.