Fix bug where form's novalidate attribute is not respected

This commit is contained in:
kushalpandya 2017-05-25 15:05:51 +05:30 committed by Jarka Kadlecova
parent c5e28a7b41
commit 69c47658c7

View file

@ -31,9 +31,13 @@ class GlFieldErrors {
* and prevents disabling of invalid submit button by application.js */
catchInvalidFormSubmit (event) {
if (!event.currentTarget.checkValidity()) {
event.preventDefault();
event.stopPropagation();
const $form = $(event.currentTarget);
if (!$form.attr('novalidate')) {
if (!event.currentTarget.checkValidity()) {
event.preventDefault();
event.stopPropagation();
}
}
}