Hey Gareth!

Gareth Evans a écrit :
> I know that a radio button is grouped via its name attribute, rather
> than having a unique id ($F() really should refer to the Id of the
> element for consistency)

It does (as per online docs, *cough*).  Which is why you won't get the
serialized value for the radio button's name=, but the specific radio
button's value.

If you wish to get the serialized value for a given input's name, you'd
have to go something like this (admittedly heavyset):

$$('#yourForm *[name="yourName"]:checked').invoke('getValue').reduce()

This returns either undefined (if no such named item is checked) or the
value (if one is).

> Why not use the $$ function to get radio buttons (internally)

There you go.

> (and rightly so, I guess)... so Form.Element.Serializers[Input](Element)
> gets passed a reference to a name instead of an id...

No, F.E.S gets passed the DOM element itself, obtained by its id=.
Again, $F doesn't work on names, but ID's, as everything in Prototype
does.  So your rewrite is essentially beside the point.

-- 
Christophe Porteneuve a.k.a. TDD
"[They] did not know it was impossible, so they did it." --Mark Twain
Email: [EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to