There is nothing in Drupal's UI that says "the red star means it is required." Instead of putting that in, I think is is a good idea to just go ahead and put the word required right there. There is no extra key to find and read. This is supported by _Research-Based Web Design & Usability Guidelines_ (http://usability.gov/pdfs/chapter13.pdf), which is a summary of various usability guidelines.

Comments

drumm’s picture

Status: Active » Needs review
StatusFileSize
new1.35 KB

And here is a patch.

webchick’s picture

Status: Needs review » Needs work

Excellent. I like this very much. However, the string 'required' is not translatable.

drumm’s picture

Status: Needs work » Needs review
StatusFileSize
new1.36 KB

Right. Adding t().

RobRoy’s picture

Is this preferred over including markup at the top or bottom of the form saying "* denotes that a field is required." or something to that effect? Might be implications of stretching out forms too much or be too overwhelming having a bunch of red "required"s instead of one small red character. I'm not a big fan of the look of the "required" after the colon as well.

I would prefer including a legend at the top or bottom explaining the star, but always injecting that markup at the top might be a bit trickier for forms with markup already at the top.

oadaeh’s picture

The "required" looks pretty clean, but it seems to me that it should be in parentheses.

drumm’s picture

Both keeping the * and adding a key and spelling out required are accepted methods. I'm not aware of any research comparing the two.

The choice is adding it to every field or adding it to the top and/or bottom of the form.

As stated in the original post- in my opinion, direct labels are better than a key because
1. No need to hunt for what a * means. Web pages are not read linearly top to bottom, so we can't assume the key will be seen before a *.
2. No need to remember what a * means. Everyone has to figure out what the * means at some point and probably remember it if they fill out enough forms.

On parenthesis- I concentrated on using color and size to make the label visually distinct and simple. Parenthesis can certainly be added by contributed themes. They can be in core if we can decide that most sites would want them.

webchick’s picture

I decided to do some Googling tonight to get to the bottom of the question of which is better.

Here's what I found:

Just Add Water recommends grouping all required fields together in a "required" fieldset, but failing that indicating required fields with an asterisk. In addition, the article points out to several prominent sites (Yahoo!, Washington Post, etc.) that use red asterisks to indicate required fields.

Forms That Work says not to use asterisks to denote fields that are optional, even when there are far more required fields than optional, because the standard convention is that they mark required fields.

A List Apart doesn't provide a preference on how to indicate required fields, but notes that they should not be in red because red normally indicates an error condition. I noticed you coloured yours maroon, so you probably read a similar article. :)

Then as a personal thing, I find it easier to scan '*' than I do "required" because my eye can't stop reading it each and every time, even though I already know what it's going to say. :P

So I'm now leaning towards keeping the *, but providing a legend. Working on a patch now...

webchick’s picture

Ok, no I'm not. I am way too tired. ;)

But basically, what needs to happen is as the form's being built, it needs to register if there are one or more required fields. If so, on form render, show the message, "* indicates a required field."

chx threw some preliminary code in a pastebin: http://drupal.pastecode.com/4692 but in my state of sleepiness I can't figure out what else to do with it. :P Hopefully someone else can have better luck. ;)

andremolnar’s picture

+1

I try to point out in the report that items like these are ultimately controlled by the theme developer and the recomendation to include the word 'required' should be a system default.

If people just want an asterisk - well that's up to them - afterall - its their site... But out of the box Drupal should consider '('. t('required') . ')'

andre

edmund.kwok’s picture

StatusFileSize
new1.39 KB

How about this? Patch sets a global variable, $required_legend and it is set to TRUE in theme_form_element if the element has the #required attribute. Then theme_form will check if $required_legend it TRUE showing the legend. Of course using something other than drupal_set_message would be better.

Or it's not a good way to get this done?

drumm’s picture

drupal_set_message() is wrong. A '* is required' key belongs as normal text right next to the form. For example, try out your patch with the login block showing.

Leaving as for review since there is a perfectly fine patch at #3.

drumm’s picture

Another review of #10- We have a whole form array with all sorts of stuff in it, $required_legend should be part of that array and not another global variable.

Jaza’s picture

-1 to changing the current system. I like my little red asterisks just the way they are.

As webchick's research points out (#7), the asterisk is a well-recognised symbol for denoting required fields. It's also much more elegant and visually pleasing than using the word 'required' all over a form.

By the way, in this case I disagree with ALA's warning against using red: no user is going to jump up and down in alarm, when they see one tiny character marked in red (especially when they already know what that character represents).

If you're really concerned about accessibility, then I found an interesting article that lists a number of strategies for implementing accessible required fields, and our current 'asterisk strategy' is one of them (and the proposed new strategy is listed as well). Another article about required form fields by Derek Featherstone (well-known accessibility guru) suggests that the asterisk is one of the best strategies, and it goes into some detail on how to best implement the asterisk for required fields.

If it ain't broke, don't fix it. And besides, this can all be customised at the theme level, if people really want to change it.

Freso’s picture

Just a couple of internationalisation related notes:

  • "*" should be inside a t() function as well, as other locales might or might not be accustomed to another character/sign/thing which means "this is required".
  • t('required') is bad, as "required" can have different translations depending on context. Please, please, please use more verbose strings than this! (Yes, I realise this also includes the "*" above. Signs shouldn't have more than one meaning anyway, but they might have anyway, depending on context.)
andremolnar’s picture

I guess this is turning into bike shed colour debate.

Positions have been stated, the patches have been made - its now up to the powers that be to make a choice without further debate.

andre

drumm’s picture

Here is an alternative patch.

The first required field has '* (required)'

The * are correctly placed in abbr tags instead of span, with a title saying what it is.

drumm’s picture

StatusFileSize
new1.71 KB
coreb’s picture

Version: x.y.z » 5.x-dev

(Moving x.y.z version to a real version number)

I'm not sure, but it looks like this issue still fits the criteria to make it into 5.x-dev branch. Although I could just as easily see it as a feature request.

I'm just moving this out of x.y.z version. Someone else put it in the correct place.

dries’s picture

I don't like the mixed approach (star + legend). Either we continue using stars, or we use required everywhere. Personally, I don't think this is a big problem. Lots of websites use a red star to denote a required field. Maybe we should simply make it so that it reads 'required' when you hover of the star.

Freso’s picture

I'm undecided on whether to stay with the "hovering", or if there should be a legend as well, however, I'd like to see $required = '<span class="form-required">'.t('<abbr title="This field is required.">*</abbr>').'</span>'; instead of $required = '<abbr class="form-required" title="'. t('This field is required.') .'">'. t('*') .'</abbr>';, as "*" without context could be many, many things (is it a warning? wildcard? star? plain, generic asterisk?). Some locales might also want to separate "This field is required." hover thing from "This field is required." error message. (Can't recall if that string actually exists, or if it's only "%s field is required." though...)

Paul Natsuo Kishimoto’s picture

8082 and 9136 are relevant.

drumm’s picture

Title: Spell out required » Improve markup for required *
Status: Needs review » Needs work
drumm’s picture

Status: Needs work » Closed (won't fix)
liam morland’s picture