Hello… I’m starting with Yii and I’m trying to build an user interface based on ajax requests. But there seems to be a problem with my ojects never firing any ajax requests. None of them (dropdowlists, textfields…nothing).
I’ve posted before about a CHtml::dropdownlist which does not fire ajax requests. Textfiels also don’t fire anything… Even CJuiAutoComplete does not work…
Example:
<div class="form">
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'cli',
'value'=>$model->cliente,
'source'=>'/faturas/clientes',// <- path to controller which returns dynamic data
'options'=>array(
'minLength'=>'1', // min chars to start search
),
));
?>
My controller has an action like this…
public function actionClientes($term)
{
$sql = 'SELECT id, CompanyName as val, CustomertaxId as label FROM app_clientes WHERE CompanyName LIKE :qterm ';
$sql .= ' ORDER BY CompanyName ASC';
$command = Yii::app()->db->createCommand($sql);
$qterm = $_GET['term'].'%';
$command->bindParam(":qterm", $qterm, PDO::PARAM_STR);
$result = $command->queryAll();
echo CJSON::encode($result);
exit;
}
I don’t know if I’m doing something wrong on every time I try to do something, or if I need to configure something at Yii level in order to use ajax…
Please help me… I’m really stucked here…