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

Hidden <select> item

Status
Not open for further replies.

zzfive03

Programmer
Jun 11, 2001
267
Hello, How would I make it so that if you click a radio button, it automatilcy makes a <select> componet become invisible, or vicea vercia. For example, I want a &quot;default&quot; radio button that does not require a selection, but if you click the &quot;custom&quot; radio, it allows the user to make a selection via the select pull down.

Thanks in advance for any help.
MH
 
Here is a VBScript Solution:

<script language=vbscript>
sub CustomRadio_onclick()
frmMyForm.SelectBox.style.display=&quot;&quot;
end sub

sub DefaultRadio_onclick()
frmMyForm.SelectBox.style.display=&quot;None&quot;
end sub
</script>

The first one is when you click on the Custom Radio button, it unhides the select box. The second sub is when you click on the Default radio button which HIDES the select box. For this to truly work correctly, you will need to set the style of the select box to &quot;none&quot; in it's tag.

i.e. <Select ID=&quot;CustomSelection&quot; style=&quot;Display:None;&quot;>

Hope this is what you are looking for... Tazzmann
 
Thanks Tazzmann..

One more question..
here is my code:

<script language=vbscript>
sub Custom_onclick()
data.site.style.display=&quot;&quot;
end sub

sub Default_onclick()
form.site.style.display=&quot;None&quot;
end sub

</script>


'Data' is the name of my form and 'site' is the name of the pulldown. When I click my radio button, it goes to this fucniton but i get an error &quot;Object Required: 'form'&quot;

Am I not calling my 'site' select the correct way?

MH
 
On your second sub, you have:

form.site.style.display=&quot;None&quot;...

it should be:

data.site.style.display=&quot;None&quot; Tazzmann
 
Tazz;

Opps, that was a typo when i submitted my code on the form, My browser still retruns a &quot;obejct required: data&quot;.

Any ideas? Thanks for the help.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top