Not sure if this is being worked on at the moment, but the date widget required marker is looking rather funky in the latest dev (see attached screen shot). Right now it’s just floating up in the top left corner, it should really be displayed next to a label.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dboulet’s picture

The labels were removed in #1233612: Add a checkbox so user can choose to show/hide the end date. I think that leaving them gone might be ok as long as we can implement #1248720: In-Line 'End Date' with 'to' text.. We should really find a new place for the required markers though.

dboulet’s picture

FileSize
5.22 KB

Maybe the best solution would be to add the marker next to the "Date" label, since that is technically the only component that is required to be filled.

KarenS’s picture

The required marker is problematic because we can have such a multitude of date sub-parts and the system error processing can interfere with what the date module is trying to do. I've tried handling this in different ways over the years, with mixed results. Plus not all sub-parts are required, even within dates that are required.

acbramley’s picture

Sub.

DamienMcKenna’s picture

Each use case needs to be defined and then the correct 'required' options be made available & labeled accordingly.

One simple use case that could be solved quickly: when the time field is not displayed and the date field is required, the main element's label should have the 'required' indicator. It may also be useful to remove the extra fieldset that gets added for this use case, but that's a separate issue.

patrickfgoddard’s picture

If this helps anyone, I needed the required asterisk to appear on the fieldset legend, so hacked it via a bit of code in a custom module:

/**
 * Implements hook_form_alter()
 */
function CUSTOMMODULENAME_form_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == 'ID_OF_FORM_HERE') {
    $form['ID_OF_FIELD_HERE']['und'][0]['#title'] .= '<span title="This field is required." class="form-required">*</span>';
  }
}
kenneth.venken’s picture

Attached is a patch that will add the red marker (form-required span) to the fieldset title in theme_date_combo.

Pedro Lozano’s picture

The patch at #7 works perfectly for me.

zilverdistel’s picture

Status: Active » Needs review

The patch fixes the appearance of the marker indeed! Thank you. Do we need more review?

I'm still experiencing a possibly related issue: http://drupal.org/node/301538: Date field does not use #required to mark required date fields.

guillaumev’s picture

Status: Needs review » Needs work

Does not work for me: the patch does add a required star to the fieldset legend (as expected) but does not remove the other star for me.

This can be fixed using CSS but ideally the other star should be removed...

AaronBauman’s picture

Status: Needs work » Needs review

patch in #7 works perfectly for me too.

guillaumev, can you provide steps to reproduce your issue on a clean install?

kenneth.venken’s picture

Attached is a patch that removes the floating marker and adds it to the label.

AaronBauman’s picture

#12 works great for me against 7.x-2.6+0-dev

kardave’s picture

Can I ask why is the 'from' label/title is hidden/empty?

Kenneth's patch makes it not just empty but hides it completely.

In case of having starting and ending dates, I think label is quite essential for both.

Thanks,
David

citlacom’s picture

It works for me over 7.x-2.6. Thanks.

babbage’s picture

Applied patch in #12. Works as desired to make a required day-month-year date with select lists display the required marker.

ginorodrigues’s picture

Placing the marker in the fieldset is considerable usability problem.

Since there are limitations for a systematic fix until now (#3), is there any possible hardcoded solution similar to #6 but applied to a the field label (rather than its fieldset) of a single date field ?

Thanks!

szt’s picture

Status: Needs review » Reviewed & tested by the community

#12 works, thanks!

dabblela’s picture

+1 to #12, thanks!

PierreMarcel’s picture

Applied #12 patch, it did the trick for us and so far no side effects.

cafuego’s picture

cafuego’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Gaofengzzz’s picture

+1 to #12, great! thanks!