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

List Of Radio buttons with other option

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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().
 
Srilakshmi Vara
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alan i will work on it
 
reply
    Bookmark Topic Watch Topic
  • New Topic