Download & Extend

Missing red asterisk for required fields

Project:Link
Version:7.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:accessibility, form render, link

Issue Summary

When a user adds a link field to a Content type with following field configuration,
field config

With this settings, while creating a content node. Field renders with no form-required style.
Fields appears as follows;

field on content type

This should, with the settings above, look like
desired output

Please suggest the way to do this.

Comments

#1

Assigned to:rahul.shinde» Anonymous

#2

I'm not much of a coder, but I can document. The red asterisk is disabled on line 683 of link.module to avoid a third red asterisk on the parent label if both Title and URL are present. The problem is that if there is no Title, and URL is required. There is no red asterisk at all.

683 $element['#required'] = FALSE; // davereids patch from jan 2011

In my attached screenshot (red-asterisk.png), "Featured Resource Link" is my parent label. Line 683 is set to FALSE for the first two examples, but TRUE for the second two.

red asterisk examples

AttachmentSize
red-asterisk.png 10.87 KB

#3

Version:7.x-1.0» 7.x-1.x-dev
Status:needs work» active

Hm, seems to become a funny WTF issue in repeat and belongs to this issues:
#1038444: Extra required indicator
#1217396: "multiple-value" & "required" breaks input/save and produces error: "At least one title or URL must be entered."

please use needs work status only for issues with included and reviewed but failed patches, which still need to get optimization.

But thanks for the report. ++

#4

Title:Missing required sign» Missing red asterisk for required fields
Assigned to:Anonymous» Digidog

and from the 7.x-1.x-dev point of view you rather refer to this line (680) I guess:

'#required' => ($settings['title'] == 'required' && (($element['#delta'] == 0 && $element['#required']) || !empty($element['#value']['url']))) ? TRUE : FALSE, // davereids patch from jan 2011

and this one at 710:

 
  // To prevent an extra required indicator, disable the required flag on the
  // base element since all the sub-fields are already required if desired.
  $element['#required'] = FALSE; // davereids patch from jan 2011

#5

Any word if this was included in the dev snapshot of 2012-Mar-01?

#6

@ DDO : this needs deeper dipping and a patch. Feel free to try your skills on it ;)

#7

Assigned to:Digidog» Anonymous

#8

Thanks for the reply. I'll investigate.

#9

same problem with dev version. any way to fix it?

#10

Issue tags:+accessibility

This is an accessibility issue. This field should be rendered like required text fields in core.

Here's what markup should look like:

<div class="form-item form-type-link-field ">
  <label for="input-id">Label <span class="form-required" title="This field is required.">*</span></label>
  <div class="link-field-subrow clearfix">
    <div class="link-field-url">
      <div class="form-item form-type-textfield">
        <input type="text" id="input-id" class="form-text required">
      </div>
    </div>
  </div>
</div>
nobody click here