aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Question on dynamically generated radio buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Question on dynamically generated radio buttons" Watch "Question on dynamically generated radio buttons" New topic
Author

Question on dynamically generated radio buttons

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Hi,
I have a JSP page which generates the name of the radio button dynamically.
My code in JSP:

<html:radio property = '<%=question.getOid()%>' value =
"<%=qvalue.getOid()%>" onklick="showRadioLayer(this)"/>

This JSP code generates 2 radio buttons with the same name(radio group) but with different values.

My code in Java Script:

function showRadioLayer(id){
var a = id.name; // I can get the name of the radio button with this
var len = document.form.a.length //I want to get length of radio group
but i cant get the length. I know this is wrong but how do i get the length of the radio group.

Please help me,
Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15362
    
    6
because you are not referecing it right...

var len = document.form.elements[a].length;

Eric
Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Thanks a lot!!!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Question on dynamically generated radio buttons
 
Similar Threads
How to check the value of Radio buttons Dynimically
Changing the content of HTML dynamically from a JSP
Radio Buttons
radio buttons selection
problem with radio buttons in nested forEach loop