{"action":"created","issue":{"url":"https://api.github.com/repos/twbs/bootstrap/issues/25626","repository_url":"https://api.github.com/repos/twbs/bootstrap","labels_url":"https://api.github.com/repos/twbs/bootstrap/issues/25626/labels{/name}","comments_url":"https://api.github.com/repos/twbs/bootstrap/issues/25626/comments","events_url":"https://api.github.com/repos/twbs/bootstrap/issues/25626/events","html_url":"https://github.com/twbs/bootstrap/issues/25626","id":297180995,"number":25626,"title":"Documentation is missing how to reset the form validation","user":{"login":"burzum","id":162789,"avatar_url":"https://avatars0.githubusercontent.com/u/162789?v=4","gravatar_id":"","url":"https://api.github.com/users/burzum","html_url":"https://github.com/burzum","followers_url":"https://api.github.com/users/burzum/followers","following_url":"https://api.github.com/users/burzum/following{/other_user}","gists_url":"https://api.github.com/users/burzum/gists{/gist_id}","starred_url":"https://api.github.com/users/burzum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burzum/subscriptions","organizations_url":"https://api.github.com/users/burzum/orgs","repos_url":"https://api.github.com/users/burzum/repos","events_url":"https://api.github.com/users/burzum/events{/privacy}","received_events_url":"https://api.github.com/users/burzum/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-02-14T17:27:59Z","updated_at":"2018-02-14T22:37:16Z","closed_at":null,"author_association":"NONE","body":"* I've read https://getbootstrap.com/docs/4.0/components/forms/#how-it-works\r\n* I've used Google & Stackoverflow\r\n\r\nI haven't found a solution... What annoys me the most is that the documentation does not show how to reset or disable validation. I shouldn't have to search the web for this common use case.\r\n\r\nI want to clear the form after submission but the validation immediately jumps in and validates the now empty form fields again, resulting in showing errors.\r\n\r\n```js\r\n\tfunction formValidation() {\r\n\t\t// Validation -> https://getbootstrap.com/docs/4.0/components/forms/#validation\r\n\t\t// Fetch all the forms we want to apply custom Bootstrap validation styles to\r\n\t\tvar forms = document.getElementsByClassName('needs-validation');\r\n\t\t// Loop over them and prevent submission\r\n\t\tvar validation = Array.prototype.filter.call(forms, function (form) {\r\n\t\t\tform.addEventListener('submit', function (event) {\r\n\t\t\t\tif (form.checkValidity() === false) {\r\n\t\t\t\t\tevent.preventDefault();\r\n\t\t\t\t\tevent.stopPropagation();\r\n\t\t\t\t\t$(form).addClass('is-invalid');\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$(form).addClass('is-valid');\r\n\t\t\t\t}\r\n\t\t\t\tform.classList.add('was-validated');\r\n\t\t\t}, false);\r\n\t\t});\r\n\t}\r\n\r\n\tfunction contactForm() {\r\n\t\t// Honeypot\r\n\t\tlet honeypot = $('#contact-website');\r\n\t\tlet contactForm = $('#contact-form');\r\n\r\n\t\thoneypot.parent('.form-group').hide();\r\n\t\thoneypot.removeAttr('required');\r\n\r\n\t\tcontactForm.on('submit', (event) => {\r\n\t\t\tevent.preventDefault();\r\n\r\n\t\t\tif (!contactForm.hasClass('is-valid')) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t$.ajax({\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\turl: 'contact.php',\r\n\t\t\t\tdata: contactForm.serialize(),\r\n\t\t\t\tsuccess: () => {\r\n\t\t\t\t\t$('#contact-form input').val('');\r\n\t\t\t\t\t$('#contact-form textarea').val('');\r\n\t\t\t\t\t$('#modal').modal('show');\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/twbs/bootstrap/issues/comments/365768280","html_url":"https://github.com/twbs/bootstrap/issues/25626#issuecomment-365768280","issue_url":"https://api.github.com/repos/twbs/bootstrap/issues/25626","id":365768280,"user":{"login":"bkdotcom","id":2137404,"avatar_url":"https://avatars3.githubusercontent.com/u/2137404?v=4","gravatar_id":"","url":"https://api.github.com/users/bkdotcom","html_url":"https://github.com/bkdotcom","followers_url":"https://api.github.com/users/bkdotcom/followers","following_url":"https://api.github.com/users/bkdotcom/following{/other_user}","gists_url":"https://api.github.com/users/bkdotcom/gists{/gist_id}","starred_url":"https://api.github.com/users/bkdotcom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bkdotcom/subscriptions","organizations_url":"https://api.github.com/users/bkdotcom/orgs","repos_url":"https://api.github.com/users/bkdotcom/repos","events_url":"https://api.github.com/users/bkdotcom/events{/privacy}","received_events_url":"https://api.github.com/users/bkdotcom/received_events","type":"User","site_admin":false},"created_at":"2018-02-14T22:37:15Z","updated_at":"2018-02-14T22:37:15Z","author_association":"CONTRIBUTOR","body":"@burzum  are you using angular?   what extensions/plugins/modules/components (whatever anguar calls plugins nowdays)?   Probably some form validation stuff going on with your angular framework/stack"}}
{"actor":{"display_login":"bkdotcom"}}