• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to capture a radio button value

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have two diffrent table in form and 2 radio button for each table, I have to do one section of functionality on select of radio button I know for sure that the capturing the radio value should do the trick.
but how do I do that using a small javascript function is my approach right to capture the radio button value and do the necessary functionality, can anyone give some snippets of js pls?
Thanks in advance
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hai
u can give names to the radiobuttons as say rb1.
then use (request.getParameter("rb1")!=null) to read whether the radiobutton is checked or not.if it is not checked it returns null.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ushank first off your name does not fit the namig policy of the ranch, you can change your display name under the my profile link above.
Now for an answer.
here is a simple loop
for (i=0;i<RadioGroupName.length;i++){
if(RadioGroupName[i].checked){
YourValue = RadioGroupName[i].value;
}
}
See if that helps you out
Eric
 
ushank
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
but I have assigned the radio buttons as type= radio name =b1 for both the radio button and I believe they are in group but is there any other way to define them as a group.
I have used the earlier piece of code in a function, and I'm checking int he block as if(checkRadio()!= null) then do these actions.
pls correct me if this is wrong.
thanks
I shall change my user name soon my name is ushanki I have cut short i.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Group is their name
 
reply
    Bookmark Topic Watch Topic
  • New Topic