Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
tiagoadp opened this Issue · 1 comment

2 participants

@tiagoadp

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( element.name ).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.

@jzaefferer
Owner

I'm sorry for the lack of activity on this issue. Instead of leaving it open any longer, I decided to close old issues without trying to address them, to longer give the false impression that it will get addressed eventually, especially after several years with no activity. It doesn't mean I'm abandoning the project, just that I'm unable to work through 200+ open issues with the little time I can afford to spend on this project.

To the reporter (or anyone else interested in this issue): If you're still affected by the same issue, please consider opening a new issue, with a testpage that demonstrates the issue with a current version of the plugin. Even better, make an attempt to fix the issue yourself, and improve the project by sending a pull request. This may seem daunting at first, but you'll likely learn some useful skills that you can apply elsewhere as well. And you can help keep this project alive. We've documented how to do these things, too. A patch is worth a thousand issues!

@jzaefferer jzaefferer closed this
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.