Frage

I would like the to add "month", "day", "year" as the first choice in the birthday menu helper? Can this be done? I don't see any examples of how to do this? Below is the code I have:

    <?php echo $this->Form->input('date_of_birth', 
        array(
            'type' => 'date',
            'label' => 'Date of Birth:<span>*</span>',
            'dateFormat' => 'MDY',
            'empty' => true,
            'minYear' => date('Y')-130,
            'maxYear' => date('Y'),
            'options' => array('1','2')
            )
        );
    ?>

Thanks, Bart

War es hilfreich?

Lösung

Here you go, the empty option accepts an array where you can specify the empty value for the individual fields using the keys month, year, day, hour, minute and meridian:

echo $this->Form->input('date_of_birth', 
    array(
        'type' => 'date',
        'label' => 'Date of Birth:<span>*</span>',
        'dateFormat' => 'MDY',
        'empty' => array(
            'month' => 'Month',
            'day'   => 'Day',
            'year'  => 'Year'
        ),
        'minYear' => date('Y')-130,
        'maxYear' => date('Y'),
        'options' => array('1','2')
    )
);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top