Skip to content

success is not called for elements where required:false #851

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

Closed
AndrewRayCode opened this issue Aug 14, 2013 · 0 comments
Closed

success is not called for elements where required:false #851

AndrewRayCode opened this issue Aug 14, 2013 · 0 comments

Comments

@AndrewRayCode
Copy link
Contributor

I'm not sure if this is a bug or not. If you have rules that are such:

    var depends = function() {
        return false;
    };

    $('form').validate({
        rules: {
            field   : { email: true, required: depends }
        }
    });

even if the email validator passes, the success function is not called on the field. Not only that, but $('[name="field"']).valid() return 0.

AndrewRayCode added a commit to AndrewRayCode/jquery-validation that referenced this issue Aug 15, 2013
Addresses issue jquery-validation#851. The comment in the code itself says "when there
are no other rules" but does nothing to enforce that comment.

This uses a jquery map function to count object keys, as Object.keys
does not work in < IE9. Taken from http://stackoverflow.com/questions/5533192/how-to-get-object-length-in-jquery
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

1 participant