D
D
des1roer2015-05-15 13:37:38
Yii
des1roer, 2015-05-15 13:37:38

Yii CJuiDatePicker reset after update?

admin.php

$this->widget('zii.widgets.jui.CJuiDatePicker', array(
    'name'=>'from_date',  
    'value'=>$defaultarray['from_date'],
    'language' => 'ru',
    'options'=>array(
        'type'=>'POST',
        'update'=>'#content',
        'showAnim'=>'fold',
        'dateFormat'=>'yy-mm-dd',
            'onSelect'=> 'js: function(dateText, inst) {'.
                             CHtml::ajax(array('type'=>'POST','datatype'=>'html','url'=>array('reports_ajax'),
                                        'data'=>array('from_date'=>'js: dateText'),
                                 'update'=>'#content',

                                 )
                                     ).
                '}',
    ),
    'htmlOptions'=>array(
    ),
));

model
if($_POST['from_date'])
            $criteria->compare('f_timestamp::date', $_POST['from_date']);

controller
public function actionReports_ajax()
    {           
        if($_POST['from_date'])
        { 
        $model = new AnalizCreate('search');
        $model->unsetAttributes();  // clear any default values
        if (isset($_GET['AnalizCreate']))
            $model->attributes = $_GET['AnalizCreate'];

        $content = $this->renderPartial('admin', array(
            'model' => $model,
        ));       
        }
    }

but on first choice I get
<form id="analiz-create-form" class="form-vertical" method="post" action="/mining/analiz/analizCreate/reports_ajax">
<input id="from_date" type="text" name="from_date">
</form>

i.e. 'the carriage turned into a pumpkin'. or rather CJuiDatePicker to a text field. How to win?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
des1roer, 2015-05-18
@des1roer

$content = $this->renderPartial('admin', array(
            'model' => $model,
        ), false, true);

S
strength2008, 2015-05-15
@strength2008

des1roer, tell me, what kind of Yii project are you working on now? If for educational purposes, can you give me an idea?

R
Roman Frank, 2015-05-15
@Akellacom

You can do it in a handicraft way, hang a click handler for a day, make an ajax request and give the necessary data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question