The main issue was about the user form and problematic error reporting. However, this problem was made bigger by defining it as:
If a field depends on another field which is faulty, the dependee field should be highlighted and show an error.
This is however something that should be handled on form validation and is outside of the scope of inline form errors.
The problematic case of the user profile form is handled in: #2455933: Error highlighting and reporting problems for the current password on the user profile form
Problem/Motivation
Follow up to #1493324: Inline form errors for accessibility and UX and #2455933: Error highlighting and reporting problems for the current password on the user profile form
With the new inline form errors, dependent fields should be linked to as they are in the global message. This will make navigattiong forms easier for screen reader users and keyboard only users.
A good example of this is the user edit form. The password change is dependent on the user entering their current password. If a user enters a new password but no current password, the error "Your current password is missing or incorrect; it's required to change the Password". Here, the "current password" should link to the actual change password field.
Proposed resolution
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#25 | 2514730-25-When-adding-dependent-field-error-message.patch | 15.13 KB | mgifford |
#9 | issue_2514730--IFE_module_disabled.png | 110.05 KB | SKAUGHT |
Comments
Comment #1
crasx CreditAttribution: crasx at Digital Bridge Solutions commentedComment #2
mgiffordComment #3
joyceg CreditAttribution: joyceg commentedIs the issue actually requiring a link or highlighting the current password field like the 'password' and 'confirm password' fields as shown in the image?
Comment #4
joyceg CreditAttribution: joyceg commentedThe error message also needs to be modified. The use of apostrophe makes it look weird.
Comment #5
mgiffordThe text "Your current password is missing or incorrect; it's required to change the Password" should be right under the "Current password" field (usually under the description actually).
This way the link from the "password" error at the top will go right to where it needs to be changed rather than 4 fields below where in is needed, when a user clicks on it.
Comment #6
AaronChristian CreditAttribution: AaronChristian at Acro Commerce commentedIt terms of visual grouping and best practices, the "Current Password" field should be right above the fields where you set your new password. At least this is how most websites handle changing password functionality.
Comment #7
SKAUGHTproject Password tab D7 makes core act this way. of course, It would be more ideal UX/UI pattern as /user/%/edit page is busy, to say. Otherwise wrapping these 3 fields in a fieldset would as least visual group them.
Comment #8
SKAUGHTjust realized, password entry is needed for changing email too. Again, it's a busy little page.
Comment #9
SKAUGHT@mgifford
i've delt with this by altering the User Module itself by reworking how the validation process senses errors. I don't think anythings wrong with the IFE module, as such.. but the way the actual form is building errors.
other touchups this includes
my comment about the password tabs, was just a comment. certainly i'm not going to try to alter anything that much.
Comment #10
SKAUGHTComment #11
SKAUGHThad attached same image twice.
Comment #12
SKAUGHTthis resets one phase i shouldn't have touched.
Comment #13
SKAUGHTremoving summary 'Data model changes' images from comment 6
Comment #15
SKAUGHTComment #16
SKAUGHTComment #17
SKAUGHTsorry #15 had typo. also corrects label uppercasing to match
Comment #18
SKAUGHTdown-stepping status for now.
Comment #19
SKAUGHTlabels sorted out. new screen shots attached.
Comment #20
SKAUGHTumm.
in relation to original issue 2455933 and mikes comment#8 . I've just realized they remade the ticket toward different subsystem. My patch should be against the org ticket.
from what i currently best understand:
This AccountFrom (in User module) isn't just a 'normal drupal form' (certainly its not a form plugin) -- it is ContentEntityForm and ties into a Validation Constraint. So my patch simply adds in a routine during it's flagValidation to rework the messages and adds in the Current Password field to be now marked as 'in error' and reworks messages..
To the point regarding FAPI, its true that fields do not have a property to notify that another child field should be triggered as an error during validation. And possibly then, a property to hold that special error message.
I would agree that it would be nice have FAPI have the ability, but this is as much a use case for forms that have more complex validation tie backs.
a follow up thought:
Comment #21
SKAUGHTin good conscience, i'm reattaching patch to 2455933.
Comment #23
yoroy CreditAttribution: yoroy commentedComment #24
mgiffordPatch no longer applies to 8.1.
Comment #25
mgiffordChasing UserAccountFormFieldsTest.php
https://api.drupal.org/api/drupal/core!modules!user!tests!src!Kernel!Use...
Comment #26
SKAUGHT@dmsmidt, should you get here..
please over this issue, look at #2455933: Error highlighting and reporting problems for the current password on the user profile form that patch is more current to this one. they are one in the same
Comment #27
mgiffordLet's mark this as a duplicate for now then of #2455933: Error highlighting and reporting problems for the current password on the user profile form
Comment #28
dmsmidtJust cleaning up a bit.
Comment #29
apadernoComment #30
mgiffordFixing the tag.