質問

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

役に立ちましたか?

解決

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')
    )
);
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top