Radio buttons are very hard to code this way. A cluster of buttons has a single name, but each button is a separate input element in the DOM, and no two elements may have the same ID, so there's no way to have a 1:1 mapping like this.
My usual pattern looks like this: <label for="elmName">Radio Group</label> <span id="elmName"> <input type="radio" name="elmName" value="foo" id="elmName_foo" checked="checked" /> <input type="radio" name="elmName" value="bar" id="elmName_bar" /> <input type="radio" name="elmName" value="baz" id="elmName_baz" /> <input type="radio" name="elmName" value="blah" id="elmName_blah" /> </span> To get ahold of the radio elements inside your function, try $('elmName').select('input') --> returns an array of the radio buttons with all the iterator goodies attached Walter On Mar 30, 2009, at 7:20 AM, simon.murgatr...@googlemail.com wrote: > > I'm trying to use Form.Element.EventObserver on a set of radio boxes > that have the same name like this: > > <input type="radio" id="rbEncryption" name="rbEncryption" > value="All" >All<br/> > <input type="radio" id="rbEncryption" name="rbEncryption" > value="Yes">Encrypted<br/> > <input type="radio" id="rbEncryption" name="rbEncryption" > value="No">Unencrypted<br/> > > I resgister the call back like this: > > new Form.Element.EventObserver($("rbEncryption"), > myCallBack.bindAsEventListener(..); > > The problem is it only registers the call back on the first of the > radio boxes. If I change the id on each input statement so each uses a > differenet name, I can register three callbacks. But I want the radio > boxes to operate as a set, with only a single possible value. > > I suspect I am going about this in the wrong way. What is the correct > way to do this so that I get told as the user selects a different > option? > > > --~--~---------~--~----~------------~-------~--~----~ 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-scriptaculous@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 -~----------~----~----~----~------~----~------~--~---