View Full Version : hiding form elements
bharatbala
10-14-2002, 01:07 PM
Hi all,
I have 4 fields in a html form. when the user selects the radio box, depending upon the user selection i have hide 2 fields in the html form. I don't know how to do that?
Can anyone out there sugguest me on this?
Rgds,
Bala Murali
Does the following give you any ideas
<form name=f1>
<input type=text name=t1 value="Text field one">
<input type=text name=t2 value="Text field two">
<input type=text name=t3 value="Text field three">
<input type=text name=t4 value="Text field four">
<P><input type=radio name=r1 onclick="f1.t1.style.visibility='hidden';f1.t2.style.visibility='hidden'">R1
<input type=radio name=r1 onclick="f1.t1.style.visibility='visible';f1.t2.style.visibility='visible'">R2
</form>
bharatbala
10-15-2002, 01:38 AM
It works :thumbsup:
Thanks for your effort.
rgds
Bala Murali
Spookster
10-15-2002, 01:45 AM
Originally posted by Mr J
Does the following give you any ideas
<form name=f1>
<input type=text name=t1 value="Text field one">
<input type=text name=t2 value="Text field two">
<input type=text name=t3 value="Text field three">
<input type=text name=t4 value="Text field four">
<P><input type=radio name=r1 onclick="f1.t1.style.visibility='hidden';f1.t2.style.visibility='hidden'">R1
<input type=radio name=r1 onclick="f1.t1.style.visibility='visible';f1.t2.style.visibility='visible'">R2
</form>
That won't work in NS4.x. When posting possible solutions to other members questions you should always make them aware what browsers your solution will work in as they might not even realize it and end up assuming it works in all browsers.
As for making it work in NS4.x it is a very involved process for hiding/showing individual form elements.
whammy
10-15-2002, 01:52 AM
The main problem I've run into is that Netscape 4.x doesn't allow for nested <div>'s... and there are other issues as well.
I personally am really tempted to redirect people to Netscape's download page if they are using Netscape 4.x at this point. :)
Roy Sinclair
10-15-2002, 02:12 PM
Whammy,
Don't send them to the Netscape download page, send them here (http://www.alistapart.com/stories/tohell/) instead.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.