hi all,
now I’m trying to display datepicker , then after the user select certain date and press submit , the selected date will be displayed under the button
here is my try
<?php
$myDate;
echo CHtml::beginForm(array('site/index'), 'post');
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'anyName',
'value'=> $myDate,
'flat' => true, // tells the widget to show the calendar inline
)
);
echo CHtml::submitButton('submit');
echo CHtml::endForm();
if (isset($_POST)) {
echo $myDate;
}
?>
how can I do my job with out model class
edit : solved as following :
index view code
<?php
echo CHtml::beginForm(array('site/index'), 'post');
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'myDate',
'flat' => true, // tells the widget to show the calendar inline
)
);
echo CHtml::submitButton('submit');
echo CHtml::endForm();
if (isset($_POST)) {
echo $n;
}
?>
and in the controller in index action method
if(isset($_POST['myDate'])){
$n = $_POST['myDate'];
}
and send $n to the view
thanks