-
Notifications
You must be signed in to change notification settings - Fork 90
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
Form validation patterns for Conditionally revealing content #249
Comments
Here's how we did it on passports. I think your repurposing of the grey [image: Inline images 1] On 8 June 2016 at 10:06, Trevor Saint [email protected] wrote:
Ed Horsford Designer |
Hi Ed. I do agree in that it looks nicer but the pattern we have does not allow this. I would effectively be adding the error onto the panel itself instead of form-group. I can't see your images if you attached any? Trevor |
No problem Ed I can see now what you are talking about. Wow those labels are massive :). I personally think the twin lines do not look as nice. And the way I showed it above does look better (my opinion only). I will role with whatever GDS suggest, but do feel that a pattern for this has not been thought out or is in the todo list. Cheers, Trevor |
I see what you mean. The first example works but only if there is only one field in the revealed section, if there is more than one then the red line is ambiguous (as to which field has the error). cc. @timpaul who is prioritising work for the Patterns and tools team. |
Thanks Gemma. That would be most helpful :) |
I'm somewhat wary of just changing the colour, though it does look nice - If you struggle to distinguish colours, not much changes when an error happens. Is it clear enough what to do? |
This is good, but I think we can simplify further and remove the red border from the parent question: After all, there's nothing actually wrong with the users response on that part of the form. The double-borders effect I can live with as it's an error, and at least the borders are aligned and of equal thickness. |
👍 This is pretty much how we handled it on passports. |
I hear your suggestion. The problem I am faced with is this. A selection must be made initially. If a user clicks Save and continue without making a selection, we need an error notification for the user. Lets say the user then makes a selection. We would still have the red border on the parent selection because we have not clicked Save and continue again. Do you see the problem? |
In that case, the child element wouldn't have the error, since that hasn't been submitted yet? If they then click submit without answering the child question, I'd expect the error on the child only. |
You are exactly right :) |
# 4.9.0 - Add websafe organisation colours - Split colours into two files with backwards-compatible colours.scss replacement # 4.8.2 - Add GOV.UK lint to lint scss files (PR alphagov#260) - Remove reference to old colour palette (PR alphagov#256) - Fix link to GOV.UK elements - tabular data # 4.8.1 - Update DEFRA brand colour to new green (PR alphagov#249) # 4.8.0 - Pass cohort name to analytics when using multivariate test (PR alphagov#251) # 4.7.0 - Add 'mailto' tracking to GOV.UK Analytics (PR alphagov#244)
Your solution works in most scenarios by modifying html. In this situation the input inherits the style error from the parent. I am wondering if the .error .form-control is an ideal css attribute?
A similar example on GOV Elements is: How do you want to be contacted? Do you have an ideas or suggestions? Thanks |
I'm in the process of updating the styles on the passports project to use more of elements. Can we increase the specificity of the form-control error styles using something like We have |
Hi @trevorsaint and @gavboulton. @gavboulton thanks, that works brilliantly. @trevorsaint let me know if these examples work for you. I've added a couple of examples to the form examples page - you can see them here: Here's the screenshots, let me know if this fixes the issues with nested errors. |
Hi @trevorsaint can you please let me know if #286 fixes this issue for you. Thanks! |
I'm looking at form validation patterns.
It would be good for a collection of validation patterns which incorporate conditionally revealing content.
As an example:
The first validation in this case would be: Choose an answer
Secondly if yes has been chosen we now have the error on the National Insurance number and not the answer.
It would be interesting to see how you handle the styling aspects of this and if it has been considered.
Thanks
The text was updated successfully, but these errors were encountered: