aspose file tools*
The moose likes Struts and the fly likes List Of Radio buttons with other option Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "List Of Radio buttons with other option" Watch "List Of Radio buttons with other option" New topic
Author

List Of Radio buttons with other option

Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
Hi All,

I have a list of radio buttons, and one of the option is other, if other radio button is clicked i have to take a text box value with the same name as radio button, Can anyone help me please..

Thanks
Srilakshmi
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
you can't do this as it is an HTML limitation. if you have 2 form elements with the same name (the 'other' radio value and the 'other' text field), the values will be combined into an comma-delimited value. the struts way to do this is name the radio option property something along the line of 'radioOption' and the text box 'otherValue'. in your action class, you need to have a conditional statement to change set the 'radioOption' value to the 'otherValue' field value.

alternatively, you can use javascript. when the user select 'other' radio button and enter value in the text box (name it anything you want), onSubmit, simply set the 'other' value to the value of the textbox before calling form.submit().


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
Thanks alan i will work on it
 
 
subject: List Of Radio buttons with other option