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
1 changed files with 7 additions and 3 deletions

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();
}
}
}