I've created a form with mandatory fields. When I tried to submit and the mandatory fields haven't been entered, the messages appear next to the fields indicating they're mandatory but the screen doesn't scroll up to those fields, it remains at the submit button at the bottom of the page.
Is there a way to accomplish this ? Otherwise it's not clear to the user why they can't submit
Is there a way to accomplish this ? Otherwise it's not clear to the user why they can't submit
Try something along these lines. Don't copy paste from forums.
jQuery('.ui.form').submit(function() {
if ( !(jQuery('.ui .form').form('is valid')) ) {
var $container = $("html,body");
var $scrollTo = $('.field.error');
$container.animate({scrollTop: $scrollTo.offset().top - $container.offset().top + $container.scrollTop(), scrollLeft: 0},300);
}
});
This topic is locked and no more replies can be posted.