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

Form Controls

Status
Not open for further replies.

ebarratt

Programmer
Apr 10, 2002
53
US
hello all! I was wondering if anyone knew how I could make items in my form hide themselves on an event firing for instance.

<Form Name=&quot;whatever&quot;>
<SELECT ID=cboPromotionType NAME=cboPromotionType STYLE=&quot;font-size:9pt; width:120px; COLOR=navy&quot;>
<OPTION VALUE=&quot;P&quot;>Standard Promotion</OPTION>
<OPTION VALUE=&quot;I&quot;>Implementor Promotion</OPTION>
</SELECT>
</FORM>

Is there a way that I can get a function to fire when a user makes a selection in this box and make another input box like a text box or something to hide itself? I need to make things on page disappear if Implementor Promotion is selected and if it is unselected I need to make them appear again. Can someonehelp!
 
Try this

<Form Name=&quot;whatever&quot;>
<SELECT ID=cboPromotionType NAME=cboPromotionType STYLE=&quot;font-size:9pt; width:120px; COLOR=navy&quot; onchange=&quot;HideTxtBox(this)&quot;>
<OPTION VALUE=&quot;default&quot; selected>Select a Promotion</OPTION>
<OPTION VALUE=&quot;P&quot;>Standard Promotion</OPTION>
<OPTION VALUE=&quot;I&quot;>Implementor Promotion</OPTION>
</SELECT>
<input type=text name=&quot;txtTest&quot; style=&quot;display:&quot;>
</FORM>
<script language=javascript>
function HideTxtBox(theField)
{
if(theField.value==&quot;I&quot;)
whatever.txtTest.style.display=&quot;none&quot;
else
{
whatever.txtTest.style.display=&quot;&quot;
}
}
</script>

Only tested on internet explorer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top