{"action":"created","issue":{"url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/1090","repository_url":"https://api.github.com/repos/guillaumepotier/Parsley.js","labels_url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/1090/labels{/name}","comments_url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/1090/comments","events_url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/1090/events","html_url":"https://github.com/guillaumepotier/Parsley.js/issues/1090","id":147398132,"node_id":"MDU6SXNzdWUxNDczOTgxMzI=","number":1090,"title":"Disable keyup validation after ParsleyFailedOnce","user":{"login":"hanxue","id":760008,"node_id":"MDQ6VXNlcjc2MDAwOA==","avatar_url":"https://avatars1.githubusercontent.com/u/760008?v=4","gravatar_id":"","url":"https://api.github.com/users/hanxue","html_url":"https://github.com/hanxue","followers_url":"https://api.github.com/users/hanxue/followers","following_url":"https://api.github.com/users/hanxue/following{/other_user}","gists_url":"https://api.github.com/users/hanxue/gists{/gist_id}","starred_url":"https://api.github.com/users/hanxue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanxue/subscriptions","organizations_url":"https://api.github.com/users/hanxue/orgs","repos_url":"https://api.github.com/users/hanxue/repos","events_url":"https://api.github.com/users/hanxue/events{/privacy}","received_events_url":"https://api.github.com/users/hanxue/received_events","type":"User","site_admin":false},"labels":[{"id":22321001,"node_id":"MDU6TGFiZWwyMjMyMTAwMQ==","url":"https://api.github.com/repos/guillaumepotier/Parsley.js/labels/wontfix","name":"wontfix","color":"ffffff","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-04-11T11:25:39Z","updated_at":"2018-08-25T06:02:03Z","closed_at":"2016-04-11T12:59:40Z","author_association":"NONE","body":"I have a custom validation function that will fill up numbers to a length of 10. With `ParsleyFailedOnce`, the code that runs the prefix does not work. I want the validation to work only when there is `focusout` instead of `keyup`. \n\nhttp://codepen.io/hanxue/pen/XdZRoE?editors=1011\n\nTo reproduce:\n1. Type in alphabets in the input field, the focus out. \n2. Parsley will show error\n3. Remove invalid input, type in numbers\n4. As soon as there is a keystroke, the validation code will run, causing the input field length to be > 10\n\nFor convenience, here is the code\n\n``` html\n<form id=\"demo-form\" data-parsley-validate>\n  <input type=\"text\" id=\"card_number\" name=\"card_number\" class=\"form-control\"        data-parsley-required=\"true\" data-parsley-trigger=\"focusout\" \n         data-parsley-required-message=\"You did not enter Card Number!\"\n         data-parsley-numeric=\"\"\n         data-parsley-zeroprefix=\"\"\n       />\n  <input type=\"submit\" class=\"btn btn-default validate\" />\n</form>\n```\n\n``` javascript\nwindow.Parsley.addValidator('numeric', {\n  validateString: function(value) {\n    return !isNaN(parseFloat(value)) && isFinite(value);\n  },\n  requirementType: 'integer',\n  messages: {\n    en: 'Enter only numbers for Card Number.'\n  }\n});\n\nwindow.Parsley.addValidator('zeroprefix', {\n  validateString: function(value) {\n    if(isNaN(parseFloat(value)) && isFinite(value)) {\n      return false;\n    }\n    else if(value < 1) {\n      return false;\n    } else {\n      if(value.length < 10) {\n        var original_length = parseInt(10) - parseInt(value.length);\n        var zero_prefix = \"\";\n        for (var i = 0; i < original_length; i++) {\n           zero_prefix = zero_prefix + 0;\n        }\n        $('#card_number').val(zero_prefix + value);\n      }\n      return true;\n    }\n  if(value.length < 10) {\n    var original_length = parseInt(10) - parseInt(value.length);\n    var zero_prefix = \"\";\n    for (var i = 0; i < original_length; i++) {\n       zero_prefix = zero_prefix + 0;\n    }\n    $('#card_number').val(zero_prefix + value);\n    value = $('#card_number').val();\n    if(value == '0000000000') {\n      return false;\n    }\n  }\n  },\n  requirementType: 'integer',\n  messages: {\n    en: 'Card number cannot be all zeroes.'\n  }\n});\n```\n\nI have looked at #1003 and #955  as well as parsley documentation, I don't see an option to disable validation for keyup() after `ParsleyFailedOnce`. \n"},"comment":{"url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/comments/415941805","html_url":"https://github.com/guillaumepotier/Parsley.js/issues/1090#issuecomment-415941805","issue_url":"https://api.github.com/repos/guillaumepotier/Parsley.js/issues/1090","id":415941805,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTk0MTgwNQ==","user":{"login":"marcandre","id":33770,"node_id":"MDQ6VXNlcjMzNzcw","avatar_url":"https://avatars2.githubusercontent.com/u/33770?v=4","gravatar_id":"","url":"https://api.github.com/users/marcandre","html_url":"https://github.com/marcandre","followers_url":"https://api.github.com/users/marcandre/followers","following_url":"https://api.github.com/users/marcandre/following{/other_user}","gists_url":"https://api.github.com/users/marcandre/gists{/gist_id}","starred_url":"https://api.github.com/users/marcandre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcandre/subscriptions","organizations_url":"https://api.github.com/users/marcandre/orgs","repos_url":"https://api.github.com/users/marcandre/repos","events_url":"https://api.github.com/users/marcandre/events{/privacy}","received_events_url":"https://api.github.com/users/marcandre/received_events","type":"User","site_admin":false},"created_at":"2018-08-25T06:02:03Z","updated_at":"2018-08-25T06:02:03Z","author_association":"COLLABORATOR","body":"Note: I edited my obsolete answer in this thread from 2 years ago..."}}
{"actor":{"display_login":"marcandre"}}