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

Cannot read property 'call' of undefined. Exception occurred when checking element XXXX, check the 'onfocusout' method. #1538

Closed
Schwoebel opened this issue Jul 29, 2015 · 2 comments

Comments

@Schwoebel
Copy link

var addCardForm = $( "#addNew" );
 addCardForm.find('input[name="PersonalId"]').rules("add", {
        onfocusout: function(element, event){
            console.log(element);
        }
  });
<form style="padding-top:10px;" class="" id="addNew" action="/card/addNewCard">
                    <div class="row">
                        <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
                            <div class="form-group">
                                <label for="pn">PersonalId</label>
                                <input type="text" placeholder="ÅÅÅÅMMDDXXXX" id="pn" class="form-control" name="PersonalId" value="">
                            </div>
                        </div>
</div>
</form>

Anytime I focus out of the field I get the error message "Cannot read property 'call' of undefined. Exception occurred when checking element pn, check the 'onfocusout' method.

Am I doing something wrong? Because I feel like this is an issue. I am following the documentation.

@Arkni
Copy link
Member

Arkni commented Oct 14, 2015

I know this issue is old, but I wanted to answer it.

The rules method used only to add your desired rules to the element, not to override the onfocusout (or other methods like: onkeyup, onfocusin ...).

See http://jqueryvalidation.org/rules/ for how to use the rules method.

@staabm
Copy link
Member

staabm commented Oct 19, 2015

Will close this issue now. Feel free to discuss it further. In case we get to a point where something need to be fixed in jquery-validate-src we can re-open it again

@staabm staabm closed this as completed Oct 19, 2015
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