carpetfrog-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2007-Jun-19 12:51 UTC
Simple check if radio buttons are clicked...
I have 2 radio button groups. One called hire_group, one called hire_period. I want my function to run only if both radio button groups have been checked. I''m fairly new to both JS and Prototype so its just a syntax question really. I''ve tried: if((document.forms[0].hire_period.checked )&&(document.forms[0].hire_group.checked )) and I''ve also tried using ($F(''hire_group'').checked )&&($F(''hire_period'').checked ) but I''m not having any luck. Can someone please explain what I need please? Many thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
David Dashifen Kees
2007-Jun-19 15:09 UTC
Re: Simple check if radio buttons are clicked...
The $F() function works off of the id attribute, not the name one. You''re best bet is to search through this group. There have been a number of functions posted that can provide you the checked value of a group of radio buttons. Using one of them, you can get the two values, both of them are valid, run your function. - Dash - carpetfrog-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org wrote:> I have 2 radio button groups. One called hire_group, one called > hire_period. > > I want my function to run only if both radio button groups have been > checked. I''m fairly new to both JS and Prototype so its just a syntax > question really. I''ve tried: > > if((document.forms[0].hire_period.checked )&&(document.forms[0].hire_group.checked )) > > and I''ve also tried using > > ($F(''hire_group'').checked )&&($F(''hire_period'').checked ) > > but I''m not having any luck. Can someone please explain what I need > please? Many thanks. > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---