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

validator.settings[eventType].call is not a function #428

Closed
lucasgonze opened this Issue May 16, 2012 · 7 comments

Comments

Projects
None yet
5 participants
@lucasgonze

lucasgonze commented May 16, 2012

Firebug reports:

[16:33:50.257] validator.settings[eventType].call is not a function @ http://localhost/~herokudev/h/js/libs/jquery-validation/jquery.validate.js:323

jquery-validation version 2.0.0pre. jquery version 1.7.1. Firefox 12.0.

    <form action="/reg/step1" method="post" id="enteremail" style="padding: 2em">
        <p><input type="text" placeholder="your-email@example.com" name="email" id="enteremailemail" required autofocus></p>
        <p><input type="submit" class="btn btn-primary btn-large" value="Save"></p>
    </form>

$(document).ready(function() {
    console.log("ready");

    $.validator.setDefaults({
        debug: true
    });

    $("form#enteremail").validate({

        onfocusout: true,
        onsubmit: true,

        /* http://docs.jquery.com/Plugins/Validation#List_of_built-in_Validation_methods */
        rules: {
            email: {
                required: true,
                email: true
            },
        }

    });


});
@lucasgonze

This comment has been minimized.

lucasgonze commented May 17, 2012

Same with 1.9.0 and 1.8.1.

@lucasgonze

This comment has been minimized.

lucasgonze commented May 17, 2012

The following code is a super simple repro case.


<!doctype html>
<head>
  <title></title>
</head>
<body>

    <form action="/reg/step1" method="post" id="enteremail" style="padding: 2em">
        <p><input type="text" placeholder="your-email@example.com" name="email" id="enteremailemail"  ></p>
        <p><input type="submit" class="btn btn-primary btn-large" value="Save"></p>
    </form>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            $("form#enteremail").validate({onfocusout: true});
        });
    </script>

</body>
@jzaefferer

This comment has been minimized.

Collaborator

jzaefferer commented May 17, 2012

true isn't a valid value for onfocusout, it has to be a function. What are you trying to achive by setting it to true?

@lucasgonze

This comment has been minimized.

lucasgonze commented May 17, 2012

I get it now.

I was experimenting to enable validation on blur. I couldn't find documentation on the legal values of the parameter, but I did find documentation did show the parameter being set to false, so I concluded that true was also a legal value.

@mlynch mlynch closed this May 23, 2012

@pjdicke

This comment has been minimized.

pjdicke commented Jan 8, 2013

http://docs.jquery.com/Plugins/Validation/validate#options

It states that you can set this to "true" or "false"

Disables onblur validation.

$(".selector").validate({
onfocusout: false
})

@arzurchris-zz

This comment has been minimized.

arzurchris-zz commented Feb 1, 2013

In fact, I think there is a trouble in the doc, try this :

onfocusin: function(element) { $(element).valid(); }
onfocusout: function(element) { $(element).valid(); }

@jzaefferer

This comment has been minimized.

Collaborator

jzaefferer commented Feb 1, 2013

I've updated the documentation to state false, Function as the type for these options (no more Boolean) and removed the misleading Default: true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment