单击日历日期后,我在设置结帐日期的值时遇到问题。这是代码。我尝试check_out_date
通过给函数填充值onSelect
,但目标输入值没有任何变化。任何人都可以帮我提供解决方案吗?
这是一段代码:
<div class="row">
<?php
echo $form->labelEx($model, 'check_in_date');
//echo $form->textField($model,'check_in_date');
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'Reservation[check_in_date]',
'value' => ($model->check_in_date) ?
$model->check_in_date :
date('m/d/Y'),
'options' => array(
'dateFormat' => 'mm/dd/yy',
'disabled' => 'true',
'showAnim' => 'fold',
//'beforeShowDay' => 'js:$.datepicker.noWeekends',
'onSelect' =>
'js:function() {
// to automatically assign check out date input value
$("#Reservation_check_out_date").val("04/23/2011");
}',
'minDate' => '0',
'changeMonth' => true,
'changeYear' => true,
),
'htmlOptions' => array(
'style' => 'height:20px;'
),
)
);
echo $form->error($model, 'check_in_date');
?>
</div>
<div class="row">
<?php
echo $form->labelEx($model, 'check_out_date');
//echo $form->textField($model, 'check_out_date');
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
/*
'model'=>$model,
'attribute' => 'check_out_date',
*/
'name' => 'Resevation[check_out_date]',
'value' => ($model->check_out_date) ?
$model->check_in_date :
date('m/d/Y', strtotime("+1 day")),
'options' => array(
'dateFormat' => 'mm/dd/yy',
'showAnim' => 'fade',
'changeMonth' => true,
'changeYear' => true,
'showOn' => 'button',
'buttonImage' => Yii::app()->request->baseUrl . '/images/calendar.png',
'buttonImageOnly' => true,
'beforeShow' =>
'js:function() {
var selectedDate = $("#' . CHtml::activeId($model, 'check_in_date') . '").datepicker("getDate");
selectedDate.setDate(selectedDate.getDate() + 1);
$(this).datepicker("option", "minDate", selectedDate);
}'
),
'htmlOptions' => array(
'style' => 'font-size:0.8em',
'disabled' => 'disabled',
),
)
);
echo $form->error($model, 'check_out_date');
?>
</div>