fix: focus invalid field on error in article form
This commit is contained in:
@@ -9,14 +9,16 @@
|
||||
var selector = (typeof(sel) == 'undefined') ? '.save' : sel;
|
||||
$(selector).off().click(function(e) {
|
||||
if (typeof initValidator === 'function') {
|
||||
console.log('click');
|
||||
e.preventDefault();
|
||||
if ($(form).valid()) {
|
||||
$(this).prop("disabled", true);
|
||||
$(this).html($(this).data('loading-text'));
|
||||
$(form).submit();
|
||||
} else {
|
||||
console.log('erreur');
|
||||
const $firstInvalid = $(form).find(':invalid, .error').first();
|
||||
if ($firstInvalid.length) {
|
||||
$firstInvalid.focus();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$(form).submit();
|
||||
|
||||
Reference in New Issue
Block a user