aspose file tools*
The moose likes Struts and the fly likes one radio button for each iteration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "one radio button for each iteration" Watch "one radio button for each iteration" New topic
Author

one radio button for each iteration

vishal gaiky
Greenhorn

Joined: Jun 06, 2012
Posts: 19
hello friedns,
i am developing one application on test in which i want to show question and four options..i am using


but i am not able to select one radio button in each row...only one radio button is getting selected for all rows..i want to select one radio button for each row of option
Jinal Prakas Shah
Ranch Hand

Joined: Jun 20, 2012
Posts: 39
I think it is because it has the same ID so the HTML is considering it as 1 list of radio button.

Regards
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30512
    
150

There are actual two problems here.

1) As Jinal noted, if you are going to use ids, they need to be unique. This isn't causing the problem you are seeing here, but it is making the web page invalid. And it means getElementById won't work.
2) Each line needs to have a different name. Since all the lines have the same name (data), you have declared only one group of radio buttons for the entire page.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
vishal gaiky
Greenhorn

Joined: Jun 06, 2012
Posts: 19
so what should i do to make different set of radio button ...means one set of radio button for each iteration.
Jinal Prakas Shah
Ranch Hand

Joined: Jun 20, 2012
Posts: 39
you can create a variable and increment it to give the id for every iteration and make sure you make the data variable a List<String>. In this way you will be able to get it for every iteration and you would not have to worry about anything.

Regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: one radio button for each iteration