canonical / vanilla-framework

From community websites to web applications, this CSS framework will help you achieve a consistent look and feel.
https://vanillaframework.io
GNU Lesser General Public License v3.0
841 stars 167 forks source link

Review "This field is required" on forms pattern #1126

Closed joanasa89 closed 7 years ago

joanasa89 commented 7 years ago

"This field is required"

2. Pattern amendment

At the moment the "This field is required" appears in a very subtle way and in the same style as the input's labels (see image) screen shot 2017-06-21 at 17 04 59

Is this a proposal or an amendment?

Proposal

I propose using a different style for "This field is required". Here some options:

A - use a different colour (maybe red colour?) and add a red outline to the empty field or B - use italic weight or C - add an asterisk at the end of each label and provide a legend which tells the meaning of it. Something like "* Indicates required field" or D - Reduce the font size to 14px

richmccartney commented 7 years ago

@joanasa89 I suggest talking to @kwm14 & @spencerbygraves as we've done work on this for MAAS and Juju to help the proposal. We've done quite a lot of work on forms.

kwm14 commented 7 years ago

@joanasa89 I adopted the styling from @spencerbygraves original design, in MAAS form fields are horizontal rather than vertical so I adjusted the position of 'form label' to address:

MAAS form validation

form-validation

joanasa89 commented 7 years ago

Cool! Looks more intuitive. @yaili is this something we can implement on ubuntu.com?

richmccartney commented 7 years ago

@joanasa89 there are other layout permutations to this, i.e we keep the label on top, or to the left with spacing and also completely inline for forms that require it.

@kwm14 We don't have any other designs showing off this layout do we?

spencerbygraves commented 7 years ago

https://github.com/vanilla-framework/vanilla-framework/issues/731

yaili commented 7 years ago

Isn't this already in Vanilla? 🤔

Some notes: The "This field is required" from the original comment should be styled as an error, and shows up on submit. We have started moving away from indicating required fields, and just indicate the optional ones, as part of the label.

anthonydillon commented 7 years ago

We have decided to move toward labelling just optional fields in the label. For example: https://github.com/canonical-websites/www.ubuntu.com/issues/649.

If the form is submitted with some blank required fields a validation error should be displayed.