-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[A11Y][D8] Added form API properties to support custom validation and error messages for required fields. #5348
Comments
To get this moving, in order to progress #1040, I've set the milestone label for the next minor release. Can I please get someone to add the actual milestone? Thanks. PR ready for review/testing: backdrop/backdrop#3844 |
Tested the PR with this form:
Worked as expected, both as above and with Reviewed the code: LGTM. |
Thanks @bugfolder 🙏🏼 ...based on your comment above, I've also se the "WFM" label. |
Hey @klonos . I haven't had a chance to test this, but at quick glance, this PR may break a test that I added in PR backdrop/backdrop#3837 that fixed the issue with the field label not being displayed in the validation error for multi-value required fields. That test is in I'm not sure about this, but there may be other tests in that file that check for validation error specific wording that may also be affected. Sorry, I don't have time until tonight to check, but you may have caught those other ones already? (Although on second thought this may not be an issue as those tests do not mess with |
That PR was merged a couple of hours ago, so let me rebase and test this again... |
Well, most likely yes, but lets make sure. ...I've rebased and pushed. Tests are currently running, so let's see. |
...OK, this was a clean rebase (no conflicts to resolve - no changes pushed), and all tests are still green. So we're good 👍🏼 |
Huh! ...interesting find while working on #5381:
...
// Check to see if the form was submitted empty.
// If it is empty, display an error message.
// (This method is used instead of setting #required to TRUE for this field
// because that results in a confusing error message. It would say a plain
// "field is required" because the search keywords field has no title.
// The error message would also complain about a missing #title field.)
if ($form_state['values']['search_block_form'] == '') {
form_set_error('keys', t('Please enter some keywords.'));
}
... Checking to see if that should be a follow-up issue to this one here, or if we can solve it with the change we're adding here... |
Thanks @docwilmot and @indigoxela! Your testing and feedback is much appreciated. @docwilmot I went ahead and changed that property name as you suggested and added code comments. Further, I reverted more of the original changes to Search module because they caused a regression in intentional behavior. If the user clicks "Search" but does not enter any terms, the intentional behavior seems to have been to take the user to the /search page before showing the error message. This makes sense, and so I left the behavior in place but updated the code comments to explain why |
Only one small language nitpick. |
We didn't get this finalized in time for 1.22.0, so I'm bumping this to the next release. |
Code reviewed. Aside from a few tiny wording/case suggestions in comments, all looks good. |
Sorry for not chiming in for so long here ...I chose to go with
...
If memory serves well (been a few months since), that's the search-related issue I mentioned I came across back in December last year. Totally confusing as you said @quicksketch, and at the time I didn't know how to proceed with it.
Yes 🤔 ...I think that we should file a follow up issue to eventually fix things properly with the search form, but I suspect that we'd need to fix things like #2732 and perhaps other issues related to how required fields are (not) handled by I'll need to have a better look at the code changes, but please do not hold this on account of me. |
@bugfolder you removed the "needs code review" label, but didn't add "rtbc" - why that? |
Overlooked it. |
…equired fields. By @klonos, @bugfolder, @quicksketch, @docwilmot, and @indigoxela.
Merged backdrop/backdrop#4054 into 1.x for 1.23.0! Thanks folks! backdrop/backdrop@7e760e9 by @klonos, @bugfolder, @quicksketch, @docwilmot, and @indigoxela. |
This is the respective issue for https://www.drupal.org/project/drupal/issues/742344, a blocker for the #5346 backport, and related to #1040.
Problem/Motivation
Proposed resolution
Remaining tasks
User interface changes
API changes
Draft of feature description for Press Release (1 paragraph at most)
Backdrop now includes two new form API properties to support specific, meaningful error messages when required form elements are empty.
Advocate for this issue: @klonos
The text was updated successfully, but these errors were encountered: