• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

radio button textfield

 
Steve Sol
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, im wanting to have 2 radio buttons in a form
When either one is clicked a textfield should appear.

So when both are clicked, there should be 2 textfields, and when one or the other is clicked, only one textfield.

I need the textfields not to be disabled, but just to not be there, as i need to validate the field if only one radio button has been clicked

Thanks
Really appreciate the help
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Radio buttons are mutually exclusive, so (assuming that they are in the same group) only one can ever be checked at a time, not two. If they are not in the same group, then radio buttons don't make sense at all. Did you mean check boxes?

In any case, you can create the text fields and hide them with CSS. Upon the check box becoming checked, you use an event handler to change the CSS to make it appear.

You'll need to learn how to establish event handlers, how to modify CSS under script control, and how to use the display CSS property to show and hide elements.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic