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

validation for drop-down menu

Status
Not open for further replies.

skw

Instructor
Jun 1, 1999
19
US
I need a validation for a drop-down menu. This validation *must not* be an onSubmit validation but something else... onMouseOver, maybe...

The problem, I have is with an html form that uses method=GET then it parses form data to other forms, based on radio button selections. This form already has two onSubmit="return" set in the form element.

I did a validation on the drop-down list, which uses onSubmit="return confirmSubmit(this)">. When I insert the onsubmit into the form element, it will not take it.

I need a validation that'll detect when the drop-down list has been skipped.

By the way, the form does not submit using a submit button, instead when the user clicks a radio button, it sends the user already filled data fields into a secondary form.

 
ok - if your select list defaults to option[0], then something like this should work (where 'mySelect' is the name attribute of your select list of course):

function isSelectSkipped() {
if (document.forms[0].mySelect.selectedIndex == 0) {
alert("You forgot the drop-down list.");
return false;
}
}





======================================

if (!succeed) try();
-jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top