I would like to use a dropdown list that would execute a different javascript funtion based on the value the user selected.
My first goal is if 1,2,3,4,or 5 is chosen the second field(named "Eway") appears. If 0 is chosen the field disappears.
My second goal is if the 2nd field is visable it needs to be required, when it is not visible it should NOT be required.
Here is what I've got so far...
<SCRIPT>
function yes() {
MMDiv.style.visibility='visible';
mainform.MakeModel.focus();
}</SCRIPT>
<SCRIPT>
function no() {
MMDiv.style.visibility='hidden';
mainform.MakeModel.focus();
}</SCRIPT>
<table width="292" align=center cellpadding=0 cellspacing=1 bgcolor=A4C0DD border=1><tr><td colspan="8">
<table border="0" align="center"><tr>
<td height=10 width="50"><B>Card 1</td>
<td>Qty
<select class=d type=text name=qty1 size=1 onchange="yes()">
<option selected value="0"></option>
<option onchange=yes() value="1">1 box of 250</option>
<option value="2">2 boxes of 250</option>
<option value="3">3 boxes of 250</option>
<option value="4">4 boxes of 250</option>
<option value="5">5 boxes of 250</option>
</td>
<td>
<DIV ID="MMDiv" style="visibility:hidden">
<LABEL FOR="MakeModel">Eway # <INPUT TYPE="TEXT" class="d" ID="MakeModel" name="requiredeway1" size="6">
</LABEL>
</DIV>
</td>
</tr></table>
</td></tr></table>
My first goal is if 1,2,3,4,or 5 is chosen the second field(named "Eway") appears. If 0 is chosen the field disappears.
My second goal is if the 2nd field is visable it needs to be required, when it is not visible it should NOT be required.
Here is what I've got so far...
<SCRIPT>
function yes() {
MMDiv.style.visibility='visible';
mainform.MakeModel.focus();
}</SCRIPT>
<SCRIPT>
function no() {
MMDiv.style.visibility='hidden';
mainform.MakeModel.focus();
}</SCRIPT>
<table width="292" align=center cellpadding=0 cellspacing=1 bgcolor=A4C0DD border=1><tr><td colspan="8">
<table border="0" align="center"><tr>
<td height=10 width="50"><B>Card 1</td>
<td>Qty
<select class=d type=text name=qty1 size=1 onchange="yes()">
<option selected value="0"></option>
<option onchange=yes() value="1">1 box of 250</option>
<option value="2">2 boxes of 250</option>
<option value="3">3 boxes of 250</option>
<option value="4">4 boxes of 250</option>
<option value="5">5 boxes of 250</option>
</td>
<td>
<DIV ID="MMDiv" style="visibility:hidden">
<LABEL FOR="MakeModel">Eway # <INPUT TYPE="TEXT" class="d" ID="MakeModel" name="requiredeway1" size="6">
</LABEL>
</DIV>
</td>
</tr></table>
</td></tr></table>
Comment