Skip to content

Conversation

@MattOz-CDS
Copy link
Contributor

@MattOz-CDS MattOz-CDS commented May 10, 2022

Summary of change

We want inline validation error messages to appear above form input fields as per the GDS pattern
https://design-system.service.gov.uk/components/error-summary/

To test

  • Enable the LocalGov forms module
  • Create a form with form elements that are required
  • In the forms behaviour settings disable client-side validation
  • Complete and submit a form with errors
  • Verify that validation errors appear above the erroneous input field

MattOz-CDS and others added 28 commits October 19, 2021 18:49
Added a media query to deal with field sizes on mobile. Make selectors more date field specific.
The localgov_os_places Geocoder plugin has moved to the localgov_geo module.  As
such, localgov_forms.geocoder.schema.yml has also moved to the localgov_geo
module and now lives on as localgov_geo.geocoder.schema.yml.
The manual address entry button labelled "Can't find the address?" is displayed
at all times at the moment.  This new configuration captures whether to reveal
this button from the beginning or only after an address search has happened.
Display the Manual address entry button labelled "Can't find the address?" based
on address lookup element configuration.
Adding a new Webform config where the Manual address entry button is displayed
*after* an address search.  This Webform is then used in a new test to verify
the behaviour of the manual address entry button.
…dress-button-display-cfg

"Can't find the address?" button display configuration
@MattOz-CDS MattOz-CDS force-pushed the feature/date-styling-and-validation branch from cb5349c to 7f72def Compare May 20, 2022 16:32
@MattOz-CDS MattOz-CDS force-pushed the feature/date-styling-and-validation branch from a4fd699 to 4378a76 Compare May 26, 2022 17:35
Copy link
Contributor

@Adnan-cds Adnan-cds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me. Thanks a lot.

I don't know if Javascript is the best way to move a form error message above its target form element. But this should do for now.

@Adnan-cds
Copy link
Contributor

Hi Matt,
Following suggestions from Ekes and Stephen Cox during the Merge Monday meeting, I have had another look at the theme templates and sure enough, the error message placement can be easily controlled from form-element.html.twig. Not sure how I missed it the first time, but it is fairly simple.

Please note that if the error message placement is to be controlled from form-element.html.twig then this has to happen in the theme instead of the localgov_forms module. This means every site that wants this feature will have to override form-element.html.twig. Or at least the localgov_base theme should override it. Is that going to be a problem?

@MattOz-CDS @ekes @stephen-cox @cjstevens78

@finnlewis
Copy link
Member

Leaving this with @MattOz-CDS for now to make a call.

@MattOz-CDS
Copy link
Contributor Author

MattOz-CDS commented Aug 3, 2022

Hi Finn,
Apologies for my delay in getting back onto this decision. Thanks for your recommendation @stephen-cox, @ekes and @Adnan-cds. I agree am happy for validation error control to be taken care of at a theme level.
Thanks again.

@finnlewis, @ekes, @stephen-cox and @Adnan-cds

@finnlewis finnlewis requested review from ekes and stephen-cox August 8, 2022 13:08
@Adnan-cds Adnan-cds mentioned this pull request Aug 8, 2022
@Adnan-cds
Copy link
Contributor

Closing as I merged some unwanted commits to this pull request earlier. This pull request has been replaced with #25.

@Adnan-cds Adnan-cds closed this Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants