I have a drop down list that populates another list, but the spry validation doesn't work for the populated list

I have a drop down list that populates another list, but the spry validation doesn't work for the list that becomes populated using javascript. Any help would be greatly appreciated, thank you!

Here is my form...

<form>
 <label> <br>
      <br>
      *Plasma or Router? </label><br/>
    <span id="spryselect1">
    <select name="select1" size="1" onChange="ldMenu(this.selectedIndex);">
      <option value="-1" selected>Select</option>
      <option name="selected" value="Plasma">Plasma</option>
      <option name="selected" value="Router">Router</option>
    </select>
    <span class="selectInvalidMsg">Please select a valid item.</span><span class="selectRequiredMsg">Please select an item.</span></span><br /><br>
*Machine:</label><br/>
<span id="spryselect3">
<select name="machine" size="1" id="machine" >
  <option selected value="">Machine</option>
  </select>
<span class="selectInvalidMsg">Please select a valid item.</span><span class="selectRequiredMsg">Please select an item.</span></span>

</form

And here is my javascript that populates the second select list...

<script language="javascript"> 

function ldMenu(mySubject) {
var Index=mySubject;
with (document.contactform.machine) 
{

document.contactform.machine.options.length=0;
if (Index==0)
{
options[0]=new Option("None"); Value=0
}
if (Index==1)
{
options[0]=new Option("select"); Value="-1"
options[1]=new Option("SideKick 4"); Value="SideKick 4"
options[2]=new Option("SideKick 8"); Value="Sidekick 8"
options[3]=new Option("SideKick 10"); Value="Sidekick 10"
options[4]=new Option("ShopMaster 8"); Value="ShopMaster 8"
options[5]=new Option("ShopMaster 10"); Value="ShopMaster 10"
options[6]=new Option("ShopMaster 12"); Value="ShopMaster 12"
} 
if (Index==2)   
{ 
options[0]=new Option("select"); Value="-1" 
options[1]=new Option("Sabre Series"); Value="Sabre Series"
options[2]=new Option("RC Series"); Value="RC Series"
options[3]=new Option("3636"); Value="3636"
options[4]=new Option("4860"); Value="4860"
options[5]=new Option("4896"); Value="4896"
options[6]=new Option("4814"); Value="4814"
options[7]=new Option("IS Series"); Value="IS Series"


}
contactform.machine.options[0].selected=false;
}
}
</script>

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.