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

Multiple Items in a validation script problem

Status
Not open for further replies.

Jimuniguy

Technical User
Mar 6, 2002
363
GB
Hi,

I have the following script which checks to see if the menu has been changed from its set vaule:

Code:
<SCRIPT LANGUAGE=&quot;JavaScript&quot;'> 
<!--
function validateForm(){
if(document.ItemList.Item.selectedIndex==0)
{
alert(&quot;Please select an Item.&quot;);
document.ItemList.Item.focus();
return false;
}
return true;
}
//-->
</SCRIPT>

Now problem is that actually the &quot;Item&quot; is called the following as there is multieple drop downs:

1.ResCatID
2.ResCatID
3.ResCatID
4.ResCatID

How can i do this please?

Thanks

James
 
<SCRIPT LANGUAGE=&quot;JavaScript&quot;'>
<!--
function validateForm(){
for (x=0; x< document.ItemsList.elements.length; x++){
if(document.ItemList.elements[x].type==&quot;select&quot;){
if(document.ItemList.elements[x].selectedIndex==0)
{
alert(&quot;Please select an Item.&quot;);
document.ItemList.elements[x].focus();
return false;
}
}
return true;
}
}
//-->
</SCRIPT>


Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Hi,

It don't work but i am unable to catch error

James
 
Caught it:

Error is:

document.itemslist.list is null or not an object

???

James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top