aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes radio button textfield Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "radio button textfield" Watch "radio button textfield" New topic
Author

radio button textfield

Steve Sol
Greenhorn

Joined: Apr 18, 2009
Posts: 4
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

Joined: Jan 10, 2002
Posts: 61238
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: radio button textfield