Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Iterate html:radio

 
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have this code in JSP:

<logic resent name = "qvalues" >
<logic:iterate id = "qvalue" name = "qvalues" >
<html:radio property = "radio" idName="qvalue" value = "value" onklick="showLayer('layer1')"/>
<bean:write name = "qvalue" property = "value" />
</logic:iterate>
</logic resent>

I have a javascript which does

var i = document.getElementById("radio").value;

suppose if i have 3 radio buttons. if i klick on one of the radio btns it should get its value. but in this case its getting the same value for all the radio buttns. Please help me out with this

Thanks,
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The qvalue is different for each iteration you might be giving different names for radio buttons check the generated HTML Code and make sure all the radio button names should be same.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Did u get the answer from somewhere else? Please share with me also as I am also getting same problem. it is every time displaying value "5".

Please Help.

Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us your code.
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try this out:

<logic resent name = "qvalues" >
<logic:iterate id = "qvalue" name = "qvalues" >
<html:radio property = "radio" idName="qvalue" value = "qvalue" onklick="showLayer('layer1')"/>
<bean:write name = "qvalue" property = "value" />
</logic:iterate>
</logic resent>

Thanks
 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic