Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

radio button

Status
Not open for further replies.

raji96

Programmer
Aug 7, 2001
64
US
I have two radio buttons 'yes' and 'no'.If 'no' if picked i should not allow the user to enter into a text field.If the user picks 'yes' then he can enter the details in the text field.
How can i do it,without reloading the page.

Thanks.
 
Make your text field hidden, then display it when 'yes' is clicked - also add a hide action to the no button in case the user changes their mind after clicking yes. Ahhhhh, I see you have a machine that goes Bing!
 
I would prefer to have the field disabled or read only and then enable field or remove read only on Yes click.
onClick="txtfieldname.disabled=true;" /false
onClick="txtfieldname.readonly=true;" /false

Either is good for me.
 
I'll go along with that - the only reason I hide my textboxes is because I keep getting people complaining that they can't fill it in, even though they haven't clicked yes.....doh! Ahhhhh, I see you have a machine that goes Bing!
 
That's why I tend to use disabled rather than readonly. At least then it looks like you shouldn't be able to do anything with it. I guess that doesn't stop some users though. [bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top