wood burning stoves*
The moose likes Struts and the fly likes html:radio - dynamic values, is it possible ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:radio - dynamic values, is it possible ?" Watch "html:radio - dynamic values, is it possible ?" New topic
Author

html:radio - dynamic values, is it possible ?

Gayatri Ganesh
Ranch Hand

Joined: Dec 23, 2003
Posts: 143
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
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
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 <cut value="${myform.okay}"/><cut 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.)


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:radio - dynamic values, is it possible ?
 
Similar Threads
html:select and html:options or html:optionsCollection
How to learn Struts Custom Tags?
html:radio - dynamic values ?
text field not populating after validate() fails.
Enabling / disabling forms (Struts)