Stop a form from submitting [Resolved]
I want to check to make sure a field is filled in before the form will submit.
I have this:
Code:
function checkforinitials()
{
if (document.dform.INIT_BADGE.options[document.dform.INIT_BADGE.selectedIndex].value == 'na')
alert("Please fill in your initials at the top of the form!");
return false;
}
Which works when called by this, except that the form still gets submitted when the error message pops up:
Code:
<form name='dform' action='submitcal.php' method='post' onsubmit='checkforinitials();'>
However, the submission is done via PHP. How do I stop the page from going through the submission when they haven't filled that item in?
Re: Stop a form from submitting Resolved
Nevermind. I just had to put "return functionname();" in the onsubmit.