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

$('form').validate().settings; not working Using jquery -v3.5.1 #2341

Closed
Tandulje opened this issue Aug 12, 2020 · 2 comments
Closed

$('form').validate().settings; not working Using jquery -v3.5.1 #2341

Tandulje opened this issue Aug 12, 2020 · 2 comments
Labels
stale Used to mark stale issues

Comments

@Tandulje
Copy link

Hi...i'am using jquery -v3.5.1 and jquery.validate -v1.9.2

My code is
var settings = $('form').validate().settings;
settings.rules['UserPrincipalName'].required = true;

it gives error
VM155:294 Uncaught TypeError: Cannot set property 'required' of undefined

When i was on older version jquey -v2.1.4 then it was working fine but now not working with jquey- v3.5.1

Please give some solution on it.
I go through lots of link but not getting related to this.
Please let me know how can i fix this issue.

Originally posted by @Tandulje in #2328 (comment)

@Tandulje Tandulje changed the title Using jquery -v3.5.1 and jquery.validate -v1.9.2 then $('form').validate().settings; not working $('form').validate().settings; not working Using jquery -v3.5.1 Aug 14, 2020
@sunny-shu
Copy link

sunny-shu commented Nov 4, 2020

When you create a validator, without passing any parameters, rules is an empty object('{}') by default。
so ‘settings.rules['UserPrincipalName'].required = true’ will get a exception ('VM155:294 Uncaught TypeError: Cannot set property 'required' of undefined')。 it has nothing to do with jquery or jquery-validation,This is a grammatical problem
you can pass your custom parameters when createing the validator。like this:
var settings = $('form').validate({
rules:{
'UserPrincipalName':{
'required':true
}
}
)
or
var settings = $('form').validate().settings;
settings.rules['UserPrincipalName'] ={ 'required ':true}

@github-actions
Copy link

This issue/proposal has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automatically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and one of the maintainers will (try!) to follow up.
Thank you for contributing :)

@github-actions github-actions bot added the stale Used to mark stale issues label May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Used to mark stale issues
Projects
None yet
Development

No branches or pull requests

2 participants