Label of year field is not present in field

Comments

tanjerine’s picture

Version: 5.x-1.3 » 5.x-1.x-dev

Hi, just wanted to say that this happens to me too. I'm using webform-5.x-1.x-dev. Thanks!

tanjerine’s picture

I forgot to mention my "fix" for it:

in the webform/components/date.inc file, under the line that says

$days = array("" => t("day"));
for ($i = 1; $i <= 31; $i++) $days[$i] = $i;  

i added 3 lines --

$yearnow = date("Y");
$years =array("" => t("year"));
for ($i = $yearnow; $i >= 1930; $i--) $years[$i] = $i;

then i commented out the lines:

  $form_item['year'] = array(
    '#type' => 'textfield',
    '#default_value' => $year,
    '#maxlength' => 4,
    '#size' => 4,
    '#validate' => array('webform_validate_date' => array('year', $component['name'], $component['form_key'], $component['mandatory'])),
    );

and made an entry below it with the following lines --

  $form_item['year'] = array(  
    '#type' => 'select',
    '#default_value' => $year,
    '#options' => $years,
    '#validate' => array('webform_validate_date' => array('year', $component['name'], $component['form_key'], $component['mandatory'])),
    );

so basically, i made the year field a dropdown select. not so sure if it will break anything else though but ill make an update if ever it does break anything.

quicksketch’s picture

Marked http://drupal.org/node/189425 as duplicate.

quicksketch’s picture

Status: Active » Fixed

The date.inc just received an overhaul, including displaying the date as a select list, just like most other date fields in Drupal. Please try out the latest dev or CVS version and open a new issue for any new problems. Thanks!

Drupal 5: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/webform/compo...
Drupal 6: http://cvs.drupal.org/viewcvs/drupal/contributions/modules/webform/compo...

Anonymous’s picture

Status: Fixed » Closed (fixed)

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