I am using WizardBehaviour and in step 3 I have some date fields.
I define the form fields for each step inside the MyWizardModel as an array.
...
// for step 3
return array(
'title'=>'Step - 3',
'showErrorSummary'=>true,
'elements'=>array(
'startDate'=>array(
//'visible'=> true,
//'onfocus'=>'alert("select"); $("#ContractWizard_startDate").datepicker();',
//'tooltip'=>Yii::app()->locale->getDateFormat('short'),
//'class'=>'zii.widgets.jui.CJuiDatePicker',
'hint'=>'Format expected ('.Yii::app()->locale->getDateFormat('short').')'
),
'endDate'=>array(
'hint'=>'Format expected ('.Yii::app()->locale->getDateFormat('short').')'
),
'buttons'=>array(
'cancel'=>array( 'type'=>'submit', 'label'=>'Cancel' ),
'submit'=>array( 'type'=>'submit', 'label'=>'Next' ),
)
);
In the controller I retrieve the config for the form step, populate any values that are missing, and pass it to the view.
In my view I use:
echo CHtml::tag( 'div', array('class'=>'form'), $form );
Is there a ‘clean’ way to link the field definition (in the model array) to CJuiDatePicker ?