i read it from the documentation that it could get ajax response by using sourceUrl.
but still no demo though. thks
Posted 22 June 2010 - 12:39 AM
Posted 01 July 2010 - 02:23 PM
daveline, on 01 July 2010 - 10:09 AM, said:
$arr = array();
foreach($models as $model)
{
$arr[] = array(
'label'=>$model->some_attr, // label for dropdown list
'value'=>$model->some_attr, // value for input field
'id'=>$model->id, // return value from autocomplete
);
}
echo CJSON::encode($arr);
This post has been edited by tri: 02 July 2010 - 06:18 AM
Posted 15 July 2010 - 09:55 AM
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'adm_area',
'sourceUrl'=>array('ac_admarea'),
'cssFile'=>false,
'htmlOptions'=>array('placeholder'=>'Any'),
'scriptUrl'=>'/protected/controllers/js',
));
?>
Posted 05 December 2010 - 01:14 AM
$form=$this->beginWidget('CActiveForm', array(
'id'=>'personas-buscapersona-form',
'enableAjaxValidation'=>false,));
echo $form->hiddenField($model, 'idperson');
echo $form->labelEx($model,'nombre');
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
// 'name' => 'Daytrip[nombre]',
'name' => 'nombre',
'sourceUrl' => array('reservatandem/SuggestPerson'),
'value' => $model->nombre,
'options' => array(
'showAnim' => 'fold',
//remove if you dont need to store the id, like i do...
'select' => 'js:function(event, ui){ jQuery("#Daytrip_idperson").val(ui.item["idperson"]); }'
),
'htmlOptions' => array(
'style'=>'height: 20px; width: 300px;',
//'style' => 'height:20px; w'
),
));
echo CHtml::submitButton('Select');
$this->endWidget();
public function actionSeleccionaCliente()
{
$model=new Personas; //para seleccionar el cliente
if(isset($_POST['Personas']))
{
$model->attributes=$_POST['Personas'];
$this->idperson=$model->idperson;
if($model->validate())
{
$this->_model = $model;
$this->redirect(array('reserva02','id'=>$model->idperson));
}
}
$iddropzone=Yii::app()->user->dropzone;
$idroll=Yii::app()->user->idroll;
$dropzone = Dropzones::model()->findByPk($iddropzone);
$this->render('buscapersona',array(
'model'=>$model,
'namezone'=>$dropzone->namezone,
));
}
Posted 18 January 2011 - 12:04 PM
tri, on 01 July 2010 - 02:23 PM, said:
$arr = array();
foreach($models as $model)
{
$arr[] = array(
'label'=>$model->some_attr, // label for dropdown list
'value'=>$model->some_attr, // value for input field
'id'=>$model->id, // return value from autocomplete
);
}
echo CJSON::encode($arr);
Posted 08 February 2011 - 03:09 PM
09 $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
10 'name'=>'test1',
11 'value'=>'test21',
12 'source'=>$this->createUrl('jui/autocompleteTest'),
13 // additional javascript options for the autocomplete plugin
14 'options'=>array(
15 'showAnim'=>'fold',
16 ),
17 ));
Posted 08 February 2011 - 05:53 PM
Herbert de Carvalho, on 08 February 2011 - 03:09 PM, said:
09 $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
10 'name'=>'test1',
11 'value'=>'test21',
12 'source'=>$this->createUrl('jui/autocompleteTest'),
13 // additional javascript options for the autocomplete plugin
14 'options'=>array(
15 'showAnim'=>'fold',
16 ),
17 ));