Hello every body,
I have a problem with a CJuiDatePicker class.
When I’m on Create Form, I can open the calendar without problems.
When I’m on the Update Form, I can open the calendar only if the field is not empty. If it is empty (or it is “0000-00-00”) I can not open the calendar.
- Exemple in Create Form :
- Exemple in Update form (When the field is not empty) :
- Exemple in update form (when field is empty) :
the calendar "refuse" to open …
My code is :
$form->widget('zii.widgets.jui.CJuiDatePicker', array(
'model' => $model,
'attribute' => 'date_depart',
//'name' => 'Transport[date_depart]',
'name' => $model->date_depart,
'value' => $model->date_depart,
'options' => array(
'showButtonPanel' => true,
'changeYear' => true,
'dateFormat' => 'yy-mm-dd',
'changeMonth' => true,
'showAnim' => 'fold',
'showButtonPanel' => true,
'autoSize' => true,
'defaultDate' => '13-03-01',
//'showOn'=>'button',
//'buttonText'=>'Open calendar',
),
));
I try to use open button, but it does not work to:
$openButton = false;
if ($model->isNewRecord == false) {
if ($model->date_arrivee == "" || $model->date_arrivee == '0000-00-00') {
$openButton = true;
$form->widget('zii.widgets.jui.CJuiDatePicker', array(
'model' => $model,
'attribute' => 'date_arrivee',
'name' => $model->date_arrivee,
'value' => $model->date_arrivee,
'options' => array(
'showButtonPanel' => true,
'changeYear' => true,
'dateFormat' => 'yy-mm-dd',
'changeMonth' => true,
'showAnim' => 'scale',
'showButtonPanel' => true,
'autoSize' => true,
'defaultDate' => '13-03-01',
'showOn' => 'button',
'buttonText' => 'Open calendar',
),
));
}
}
if ($openButton == false) {
$form->widget('zii.widgets.jui.CJuiDatePicker', array(
'model' => $model,
'attribute' => 'date_arrivee',
'name' => $model->date_arrivee,
'value' => $model->date_arrivee,
'options' => array(
'showButtonPanel' => true,
'changeYear' => true,
'dateFormat' => 'yy-mm-dd',
'changeMonth' => true,
'showAnim' => 'scale',
'showButtonPanel' => true,
'autoSize' => true,
'defaultDate' => '13-03-01',
),
));
}
open calendar button does not appear when I am in the condition
Do you know the solution?