Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Checkelement with ignored class, throws error with $(element).valid() #1006

tiagoadp opened this Issue · 0 comments

1 participant

Tiago Diaz
Tiago Diaz

I will explain my software need first:

I have a form, inside this form i got some listings, like (add user fieldset), those validated users get added to the form with hidden fields... Its working without problem... I set those inputs as .ignoreMe and on ignore setting i put this class, wonderfull!

However i need some of the to have a checkbox or radiobutton and this is the problem...

Now i will explain the problem:

Those fieldsets are dinamically generated, so i validate the form on submit, and i validate those fields .ignoreMe on user add, or something else... In the time i need it... But if i put a checkbox or a radio the $("#checkbox").valid() throws an error:

Uncaught TypeError: Cannot read property 'name' of undefined jquery.validate.js:723

So i debugged the jquery.validate to find the problem... And the problem is the line 729 inside the method:

validationTargetFor: function( element ) {
            // if radio/checkbox, validate first element in group instead
            if ( this.checkable(element) ) {
                element = this.findByName( ).not(this.settings.ignore)[0];
            return element;

Aparently the line 729 returns no element because the same element is on ignore setting, BUT i am making a manual validation of this field, so it throws the error that the element is undefined...

So i commented the line 729, and its working wonderfull, everything is working, the sublists, the forms, the checkboxes and radios on the normal form and on the sublist form... I dunno why when i removed the .not() from the line 729 it gives me another errors:

Exception occurred when checking element undefined, check the 'required' method. TypeError {stack: (...), message: "Cannot call method 'toLowerCase' of undefined"} jquery.validate.js:570
Uncaught TypeError: Cannot call method 'toLowerCase' of undefined jquery.validate.js:1001

But as i got something like 7 hours debugging and trying to solve the problem i got the easy way for now, BUT maybe the more experienced could get the job done more easily or elegantly...

Tnx for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.