FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Disabling a textbox on click of a radio button

 


vignesh_natraj
I need a javascript to disable text box (6 different text boxes) on click of a radio button and activate it on click of another radio button
thanks
mariohs
I don't know how much javascript you know, but it's just a matter of setting the disabled property to true or false.

I've created a test page for you to see it live. I think it covers most of what you want to do. I'm not a javascript pro (not even close), so other pro members feel free to modify my code to make it better.

I did with only 2 boxes, but it's just a copy / paste / modify job, it'll be easily modified. As well, I put all of them hardcoded (again, not a pro), but of course you can try to do something more dinamic.

Text boxes are by default disabled, just change the html code if you want it enabled by default.

I tested in IE6, Firefox 2 and Opera 9. All of them successful. Note that IE6 doesn't change the text box to the grey color when disabled, but it IS disabled.

Enough said... check it out and post here if you have any doubts Wink

http://mariohs.frih.net/testes/vignesh.html
and the js:
http://mariohs.frih.net/testes/vignesh.js
vignesh_natraj
right now I am not able to access the server I will tell you when I am able to access it. Also thanks for taking your time to do this ++
[edit]
I visited your example but take this case which I need to solve there is only two radio buttons(and not 4) and on click of first one I need the two textboxes to be enabled and and on click of second button I need both text boxes to be disabled thanks
[/edit]
mariohs
Ok, new version is on the air Very Happy
Check it out and see if it fits your needs.
vignesh_natraj
great work thankss Very Happy
mariohs
If you need more assistance while coding, feel free to ask here Very Happy
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.