My code looks a little like this:
...
if (reason.options[reason.selectedIndex].value == "0") {
alert("You must pick a reason for selecting this carrier");
return false;
}
...
I’m checking to see if they left the drop down list untouched (value=”0″) and if they are, I put up an alert. The return false should stop the alert from refreshing/post back, but it seems to clear everything still. Ideas?
The
return falsewill only stop the action if it is the top-level function.That works. This does not:
You need to make sure you “pass on” the return value, so something like: