Hello All,

I was wondering if anyone out there can suggest any solution on how removing the colon sign (:) in front of Contact Form fields in Drupal 6.

Thank you for your help in advanced.

Comments

rstaylor’s picture

One way to control colons in forms is to override theme_form_element() with a phptemplate_form_element($element, $value) function in your theme's template.php. In the part about if (!empty($element['#title'])), you can remove the colon or wrap it:

  //[...]
  if (!empty($element['#title'])) {
    $title = $element['#title'];
    $colon = '<span class="label-colon">:</span>';
    if (!empty($element['#id'])) {
      $output .= ' <label for="'. $element['#id'] .'">'. $t('!title!colon !required', array('!title' => filter_xss_admin($title), '!colon' => $colon, '!required' => $required)) ."</label>\n";
    }
    else {
      $output .= ' <label>'. $t('!title!colon !required', array('!title' => filter_xss_admin($title), '!colon' => $colon, '!required' => $required)) ."</label>\n";
    }
  }
  //[...]

Wrapping it with a span like this should apply to all forms but have no effect by default, and allows you to specify in CSS which forms/fields to hide the colons.