Problem/Motivation

we should probably return
$element['value'];
instead of
just
$element
in case of an validation error.

Steps to reproduce

If you use Drupal core inline_form_errors module, you will note, that the link to the error element provided on top of the page will not scroll to the actual field. This is an indication of wrong error element returned. By using $element['value'] instead this gets fixed.

Screenshot with inline form errors:
Inline Form errors

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork isbn-3605846

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

stefan.korn created an issue. See original summary.

stefan.korn’s picture

Status: Active » Needs review
schillerm’s picture

Status: Needs review » Reviewed & tested by the community

Hi hello, I just tested and reviewed MR! 17

old anchor element
<a href="#edit-field-isbn-0">ISBN</a>

new anchor element
<a href="#edit-field-isbn-0-value">ISBN</a>

New link works as expected. Simple code change, moving to RTBC.

megachriz’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the fix! I tested with and without inline_form_errors module. When inline_form_errors module is installed the link in the error message doesn't indeed let you jump to the field without the fix. And with the fix it does.

I scheduled the merge.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.