Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment