Hi, at the Create User form, submitting with an already existing user name or email returns an error requesting to change them for ones that are not used. I would like to know if it’s possible to validate on the client side and show an error without submitting the form.
While browsing I found the JQuery Validation supports a remote
rule which requests the server with the data and it receives a true
/false
response in whether the data already exists:
validator = $('#emailForm').validate({
rules: {
newEmail: {
required: true,
remote: {
url: '/rest/checkDupEmail',
data: { email: $('#newEmail').val()},
dataFilter: function(data) {
var json = JSON.parse(data);
console.log($('#newEmail').val());
console.log(data);
}
}
}
}
});
(code source: https://stackoverflow.com/questions/27573916/jquery-remote-validation-passing-extra-parameter)