• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

html:radio - dynamic values, is it possible ?

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a question regarding the <html:radio.

I have 5 radio buttons in a group.
The last 3 have a textfield and a <html:select besides it.
So when the user clicks on say the 3rd radio, I need the value to be submitted equal to "xyz" + the selected value in the <html:select.

So, the code is like this :

<html:radio property="okay" value="1"/> 1
<html:radio property="okay" value="2"/> 2
<html:radio property="okay" value="3"/> 3
<html:select property="selectedValueA">
<html ptions name=myform" property="mylist1"/>
</html:select>

<html:radio property="okay" value="4"/> 4
<html:select property="selectedValueB">
<html ptions name=myform" property="mylist2"/>
</html:select>
<html:radio property="okay" value="5"/> 5
<html:select property="selectedValueC">
<html ptions name=myform" property="mylist3"/>
</html:select>

So if user selected radion button 3, I need the value to be submitted = "3" + whatever was selected from the dropdown with property="selectedA"
(i.e the value of the radio button + value selected in dropdown)
Is there any way we can do this ?
I trieds to put
value="3 + <c ut value="{myform.selectedB}"/>"
but it complains.

Does anyone know how we can do it ?

Thanks,
Gayatri
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you are submitting this to an action first, it's better to concantenate the value INSIDE the action class. if you simply want to display, your JSTL should be <c:out value="${myform.okay}"/><c:out value="${myform.selectedA}"/> (obviously, you'll need to have c:choose to display selectedA if myform.okay value is 3, selectedB if value is 4 etc.)
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic