Skip to content Skip to sidebar Skip to footer

Javascript Confirm Cancel Still Submits Form

I have the following sequence on a form page, first it runs through the captcha then it validates the email address and then asks if you are sure you want to unsubscribe. Everythin

Solution 1:

confirm returns a boolean - true if the user clicked "Ok", false if they clicked "Cancel", so simply return the result of the confirm call:

if (validEmail(frm.Email.value) == true) {
  return confirm('Are you sure you want to unsubscribe?');
}

Post a Comment for "Javascript Confirm Cancel Still Submits Form"