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

ensure selection of menu items

Status
Not open for further replies.

Richey

Technical User
Aug 29, 2000
121
GB
I have an asp page,App3, which has a combo box, defined as below

<SELECT NAME=&quot;Section7_NewAccessType&quot; onClick=&quot;return extracheck(this)&quot;><OPTION><OPTION>Vehicular<OPTION>Pedestrian</SELECT>

I have a separate file, called Validationserver.js, which contains all my java functions. These are called on my App3 asp page. They all work bar my combo box one. It is called from App3 as follows

ErrorMsg += combocheck(formToValidate.elements(&quot;Section7_NewAccessType&quot;));

The function combocheck, held within Validationserver.js is written as follows

function combocheck(combofield)
{
var accesschoice
accesschoice = combofield.selectedIndex
if(combofield.options[accesschoice].value==&quot;&quot;)
{
return &quot;You have not completed the &quot; + combofield.name + &quot; field\n&quot;;
}
{
return &quot;&quot;;
}
}

When I run the page, and leave the combo box empty, sure enough the error message is called. The problem is when I choose a menu item, the error message is still called? despite the fact it is not a &quot;&quot;

any ideas much appreciated
Richey
 
You need to set accesschoice = combofield.selectedIndex.value

then

if (accesschoice==&quot;&quot;)
{
return &quot;blah&quot;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top