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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

forms

Status
Not open for further replies.

vlitim

Programmer
Sep 2, 2000
393
GB

I have a yes/no radio button, if they click no then they shouldn't be able to use a dropdown box. Is there anyway of deactivating the dropdown box if they click no!?!?

help please!

 
fire the event : onclick
disactivating the drop down :
- under ie4+ : use disabled (formname.elementname.disabled=true)
- cross browser solutions :
* low tech (will work almost anywhere) formname.elementname.onfocus=blur;
* using css : formname.elementname.style.display="none" (actually this HIDES the drop down not only disable it)
 
Cheers for that I like the css one, one problem is that on netscape I get this error

banking.dropdown.style has no properties.

using this code:

<form name=banking>

<input type=radio name=rad1 value=yes onclick=banking.dropdown.style.display=&quot;inline&quot;>YES
<input type=radio name=rad1 value=no onclick=banking.dropdown.style.display=&quot;none&quot;>NO
<br><br>

<select name=&quot;dropdown&quot; size=&quot;1&quot;>
<option selected>--</option>
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
</select>

</form>

is this my mistake or just netscape being crap?!

 
oups, i'm sorry i didn't have time (still haven't) to check at devedge's ... maybe you should go there and double check what i'm saying here ;-)
-> try to replace &quot;inline&quot; with &quot;block&quot;
-> try style.visible=&quot;show&quot; (and visible=&quot;hide&quot;)
-> try formname.elemmentname.display=&quot;none&quot; ...(without the STYLE part)
if none of those help you, i'm afraid you'll have to go to devedge - or wait till monday that i have some spare time to go & check !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top