$("#changePassword").validate({
rules: {
newPassword: {
required: true
},
newPassword2: {
required: true,
equalTo: "#newPassword"
}
}
});
Hey guys this is my validation code.
And this is my password check
$('#oldPassword').change(function() {
var password = $(this).val();
$.post('/settings/check/oldPassword', { value : password }, function(data) {
if (data == 'false') {
$('#oldPassword').removeClass('valid');
$('#oldPassword').addClass('error');
}
});
});
How do I make it so the form will not submit when it has this error. I also thought jquery validation didn't submit if a form element had the class error but apparently not. The error class is getting added fine but you can still submit the form. Thanks for any help.
EDIT
Here is the form.
<input type="text" name="oldPassword" placeholder="Old Password" value="" title="Old Password" class="hint" id="oldPassword" size="30" />
<br />
<br />
<input type="password" name="newPassword" placeholder="New Password" value="" title="New Password" class="hint" id="newPassword" size="30" />
<br />
<br />
<input type="password" name="newPassword2" placeholder="Verify Password" value="" title="Verify Password" class="hint" id="newPassword2" size="30" />
<br />
<br />
<input type="submit" id="submitForm" value="Change Password" />