I can't figure out how to bypass a form field inside a form when a certain button is clicked.
Example:
In my case, I want to bypass the newpassword and newpassword2 (which is needed if the user wants to change password) because I have a button so the user can delete his account. Without bypass, he has to fill in a newpassword and confirm it before he can delete his account.
These are the id's:
- Delete button:
deletemyacc - Form name:
updelacc(because update / delete account option within this form) - Form field names to bypasss:
newpasswordandnewpassword2
Now this code works, but it skips ALL validations, while I still want the old password form field to be validated and the users email.
$("#deletemyacc").click(function () {
$("#updelacc").validate().cancelSubmit = true;
});