Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Drupal 8 inline_form_errors with field_group
// Inline_form_errors module gives links to elements with errors.
// When using field_group module (this is for vertical tabs) you need to first open the right vertical tab
// and then scroll to the element with the error.
$('.messages__list a', context).on('click', function(e) {
var url = $(this).attr('href');
var hash = url.substring(url.indexOf('#'));
var index = $(hash).parents('.vertical-tabs__pane').index() - 1;
if (index >= 0) {
$('ul.vertical-tabs__menu li').eq(index).find('a').click();
}
$('html, body').animate({
scrollTop: $(hash).parent().offset().top-150
}, 500);
e.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.