Any field set as required will not render the required mark (red asterisk) if the field has no title set. This is most commonly visible on checkboxes where the title is placed together with the field.

The attached patch should fix it. I didn't find any form where it brought a negative impact.

Regards,
FredCK

PS:. I've just checked that the fixed function (theme_form_element) has been moved from theme.inc to form.inc in the CVS, so the fix must be applied there.

Comments

drumm’s picture

Status: Needs review » Needs work

Please provide a patch for CVS and form.inc.

FredCK’s picture

StatusFileSize
new883 bytes

Well... it was not that difficult with make the changes based on the diff.

I don't work with the CVS, so here (attached) is the patched code for the theme_form_element function, based on version 4.7.3.

FredCK’s picture

Status: Needs work » Needs review
killes@www.drop.org’s picture

Status: Needs review » Active

that's not a patch, see drupal.org/diffandpatch

FredCK’s picture

Ok... here is the code:

function theme_form_element($title, $value, $description = NULL, $id = NULL, $required = FALSE, $error = FALSE) {

  $output  = '<div class="form-item">'."\n";
  $required = $required ? '<span class="form-required" title="'. t('This field is required.') .'">*</span>' : '';

  if ($title) {
    if ($id) {
      $output .= ' <label for="'. form_clean_id($id) .'">'. t('%title: %required', array('%title' => $title, '%required' => $required)) . "</label>\n";
    }
    else {
      $output .= ' <label>'. t('%title: %required', array('%title' => $title, '%required' => $required)) . "</label>\n";
    }
    $output .= " $value\n";
  }
  else
    $output .= t('%value %required', array('%value' =>$value, '%required' => $required)) . "\n";

  if ($description) {
    $output .= ' <div class="description">'. $description ."</div>\n";
  }

  $output .= "</div>\n";

  return $output;
}
magico’s picture

Version: 4.7.3 » 5.x-dev

Confirmed at theme_form_element() in form.inc

stevenpatz’s picture

Version: 5.x-dev » 6.x-dev
Status: Active » Needs review
StatusFileSize
new1.98 KB

is this still an issue? Here's a patch of the code supplied in the previous comment.

catch’s picture

http://drupal.org/node/114091 was duplicate.

This still applies with a bit of offset.

Anonymous’s picture

Status: Needs review » Postponed (maintainer needs more info)

Is this still an issue?

Can this be moved into testing, after review?

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

No response, patch is from 2007, closing.