IEF Complex forms doesn't scroll to the validation errors area on AJAX submit

Created on 28 July 2022, over 2 years ago
Updated 4 June 2023, over 1 year ago

Problem/Motivation

IEF Complex forms do the submission via AJAX call. But they don't do the scroll to the message area, to make the error messages visible to the user.

Steps to reproduce

1. Open an entity edit form with some long IEF Complex form (with "Update" button), that doesn't fit vertically to the screen, with a required field at the top.

2. Keep the required field empty, submit the IEF Complex form.

It will reload, but will not be successfully submitted. And you even don't see the reason why, because the form were submitted via AJAX call and the error message appears at the top of the form. But the "Update" button is in the bottom of the form, so you don't see that something appears, and don't see the Error Message without scrolling up.

Proposed resolution

To solve this problem we need to check the availability of errors, and if they exist - scroll the page to the Error Message area.

We have an AJAX function ScrollTopCommand that implements the scrolling, so can reuse it to implement the required behavior.

But the problem is that function is located in Views module, so now we need to include views/views.ajax library to make it works, and it will not work if the Views module is not installed. But here ✨ Move ScrollTopCommand views Ajax command to the Drupal Core Fixed is my proposal to move this useful function to Drupal core.

As for now, I've created a patch, that checks the availability of the views module and if it is enabled - attaches library and implements the scrolling to the message area.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Postponed: needs info

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡²Armenia murz Yerevan, Armenia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024