Skip to content
Snippets Groups Projects
Commit b722f0a3 authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Scroll to the first form error

parent 40af4ee4
No related branches found
Tags 1.6.2
No related merge requests found
......@@ -16,6 +16,9 @@ export default class SgJobs {
$('#apply-cover-letter').on('change', SgJobs._checkFileSize);
$('#apply-cv').on('change', SgJobs._checkFileSize);
$('#apply-certificate').on('change', SgJobs._checkFileSize);
if ($('.sg-jobs-validation-error').children().length > 0) {
this._scrollToFirstError();
}
}
/**
......@@ -39,6 +42,17 @@ export default class SgJobs {
});
}
/**
* Scroll to the first error of the form
*
* @private
*/
_scrollToFirstError() {
let $errors = $('.sg-jobs-validation-error:has(li)'),
errorOffset = $errors.parent().offset();
$(window).scrollTop(errorOffset.top);
}
/**
* Filter for the joblist, simply apply the form
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment