-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Async rules fail and show "success" even if they get 200 OK from the api #24
Comments
Dominar doesn't check what response from the server is at all, it's down to the user to call Dominar.Validator.registerAsync('username_taken', function (username, attribute, parameters, passes) {
$.get(url, { username: username }, passes)
.done(function() {
passes();
})
.fail(function (response) {
passes(false, response.responseJSON.message);
});
});
}); Also atm dominar doesn't support having a 'success message' only a failed message. I can add support for that though, would be pretty useful. |
It would be useful I guess, but at the moment I'm trying to make the validation pass (make input box green and hide the "success" message), even after I added a call to |
Can you setup a fiddle or repo I can check?
|
I edited the comment above with more info, did it help by any chance? |
What does your dominar initialisation look like?
|
var validator = new Dominar(document.getElementById('the-form'), {
username: {
rules: 'required|email|username_taken',
triggers: ['keyup', 'change', 'focusout'],
delay: 300
}
})); |
I can't seem to replicate the issue, seems to work fine for me. http://jsfiddle.net/18yb3aja/ |
I've setup a fiddle which shows the problem here: http://jsfiddle.net/dnran7da/4/ |
If you put |
Yep, that was it, it works now, also a call to |
Also, it should say: .done(function() {
passes();
}).
.fail(function (response) {
passes(false, response.responseJSON.message);
}); to show response message, |
Async rules fail and show "success" even if they get 200 OK from the api
The text was updated successfully, but these errors were encountered: