Add return false; in case of cancel
function confSubmit(form) {
if (confirm("Are you sure you want to submit the form?")) {
   $("#employmentForm").submit();
}
else return false; <----------
}//End of confSubmit function


On Nov 15, 3:03 pm, flycast <[EMAIL PROTECTED]> wrote:
> I have a long form where some of the fields are required. The problem
> is that the user is sometimes getting to the point where they have
> filled all the required fields in but is not done and then hits enter
> rather than tab to go to the next field. When they do this the form
> submits. I want to conform that the user really wants to submit when
> they hit enter.
>
> This does not work:
>
> function confSubmit(form) {
> if (confirm("Are you sure you want to submit the form?")) {
>    $("#employmentForm").submit();
>
> }
> }//End of confSubmit function
>
> I get a popup corectly but if I hit cancel on the confirm dialog then
> the form validates/submits anyway rather than returning to the form.

Reply via email to