{"action":"created","issue":{"url":"https://api.github.com/repos/jzaefferer/jquery-validation/issues/354","labels_url":"https://api.github.com/repos/jzaefferer/jquery-validation/issues/354/labels{/name}","comments_url":"https://api.github.com/repos/jzaefferer/jquery-validation/issues/354/comments","events_url":"https://api.github.com/repos/jzaefferer/jquery-validation/issues/354/events","html_url":"https://github.com/jzaefferer/jquery-validation/issues/354","id":3966036,"number":354,"title":"Unable to overwrite old validator","user":{"login":"kaluzar","id":1607705,"avatar_url":"https://avatars.githubusercontent.com/u/1607705?v=3","gravatar_id":"","url":"https://api.github.com/users/kaluzar","html_url":"https://github.com/kaluzar","followers_url":"https://api.github.com/users/kaluzar/followers","following_url":"https://api.github.com/users/kaluzar/following{/other_user}","gists_url":"https://api.github.com/users/kaluzar/gists{/gist_id}","starred_url":"https://api.github.com/users/kaluzar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaluzar/subscriptions","organizations_url":"https://api.github.com/users/kaluzar/orgs","repos_url":"https://api.github.com/users/kaluzar/repos","events_url":"https://api.github.com/users/kaluzar/events{/privacy}","received_events_url":"https://api.github.com/users/kaluzar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2012-04-04T06:53:12Z","updated_at":"2015-06-26T16:25:31Z","closed_at":"2015-06-26T16:25:31Z","body":"Once you create a validator on a form you are unable to create a new one on it. The old one is always reused regardles of the options passed into the validate method. \r\n\r\nExample:\r\n```html\r\n<html>\r\n  <body>\r\n    <form id=\"myform\">\r\n      <input name=\"email\" type=\"text\"/>\r\n      <input name=\"lastname\" type=\"text\"/>\r\n      <button name=\"checkemail\" type=\"button\" onclick=\"checkemail()\" >check email</button>\r\n      <button name=\"checkall\" type=\"button\" onclick=\"checkAll()\" >chek all</button>    \r\n    </form>\r\n  </body>\r\n</html>\r\n```\r\n\r\n```javascript\r\nfunction checkemail(){\r\n        var validator = $('#myform').validate\r\n\t\t({rules: \r\n\t\t\t{\r\n\t\t\t\temail: {required: true, email: true}\r\n\t\t\t}\r\n\t\t});\r\n     var result = validator.form();\r\n     alert(result);\r\n}\r\nfunction checkall(){\r\n        var validator = $('#myform').validate\r\n\t\t({rules: \r\n\t\t\t{\r\n\t\t\t\temail: {required: true, email: true},\r\n\t\t\t\tlastname: {required: true}\r\n\t\t\t}\r\n\t\t});\r\n     var result = validator.form();\r\n     alert(result);\r\n}\r\n```\r\n\r\nIn this scenario if you press check email button first and then check all button the validate method will return the old validator which validates the email only. Instead it should either create a new validator (since the options have changed) or the library should introduce a new method that would remove the old validator. The workaround for this is to run _$.data($('#myform')[0], 'validator', null);_ before invoking _$('#myform').validate_.\r\n\r\nSince there is a workaround for this scenario I would say that this issue is rather low priority but it would be good to introduce a solution for it to make the the library more consistent."},"comment":{"url":"https://api.github.com/repos/jzaefferer/jquery-validation/issues/comments/115746255","html_url":"https://github.com/jzaefferer/jquery-validation/issues/354#issuecomment-115746255","issue_url":"https://api.github.com/repos/jzaefferer/jquery-validation/issues/354","id":115746255,"user":{"login":"jzaefferer","id":52585,"avatar_url":"https://avatars.githubusercontent.com/u/52585?v=3","gravatar_id":"","url":"https://api.github.com/users/jzaefferer","html_url":"https://github.com/jzaefferer","followers_url":"https://api.github.com/users/jzaefferer/followers","following_url":"https://api.github.com/users/jzaefferer/following{/other_user}","gists_url":"https://api.github.com/users/jzaefferer/gists{/gist_id}","starred_url":"https://api.github.com/users/jzaefferer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jzaefferer/subscriptions","organizations_url":"https://api.github.com/users/jzaefferer/orgs","repos_url":"https://api.github.com/users/jzaefferer/repos","events_url":"https://api.github.com/users/jzaefferer/events{/privacy}","received_events_url":"https://api.github.com/users/jzaefferer/received_events","type":"User","site_admin":false},"created_at":"2015-06-26T16:25:31Z","updated_at":"2015-06-26T16:25:31Z","body":"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.\r\n\r\nTo the reporter (or anyone else interested in this issue): If you're affected by the same issue, consider opening a new issue, with a testpage that shows the issue. Even better, try 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](https://github.com/jzaefferer/jquery-validation/blob/master/CONTRIBUTING.md). A patch is worth a thousand issues!"}}