Skip to content
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

No validation on first call #25

Open
arcteixeira opened this issue Apr 10, 2018 · 2 comments
Open

No validation on first call #25

arcteixeira opened this issue Apr 10, 2018 · 2 comments

Comments

@arcteixeira
Copy link

arcteixeira commented Apr 10, 2018

Hi,

The first call I make to mailgun_validator doesn't really happen. I've checked the network log and there is no validation requests. I then focus on the element that calls the validation, blur and the call is correctly made.

This is my code:

$("#email").blur(validateEmail);

var validateEmail = function() {
    var email = $("#email");
    if (email.val() !== "") {
        email.mailgun_validator({
               api_key: 'XXXXXXX',
               in_progress: in_progress_callback, // called when request is made to validator
               success: success_callback,         // called when validator has returned
               error: validation_error,           // called when an error reaching the validator has occured
        });
};

I have logs in every method and I see that after the first call neither success_callback nor validation_error are called. Any ideas?

@macaetano
Copy link

Same issue here, the first call does never work.

@jcoon97
Copy link

jcoon97 commented Oct 30, 2018

If you look at the code, it binds to an element object and then only runs the validator once the input is blurred. This was posing a problem for me, as well, so I created my own repository inspired by this one that will let you call the method whenever you like and receive a callback response via AJAX. You can view it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants