Ashiro
(Doug Bromley)
March 23, 2011, 3:17pm
1
I’m looking to send some extra parameters form my form along with the autocomplete. So the data sent isn’t just based on the text typed but a previously set value also.
I notice the old CAutoComplete has an “extraParams” field but CJuiAutoComplete doesn’t.
Is there a new way of doing this or does anyone know of a way to do it?
I basically want to append extra data form other fields to the backend search.
this can be a starting point
in the view
<?php
echo CHtml::dropDownList('dr',null,array('se', 'sel2', 'Item3'));
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'test1',
'options'=>array(
'search'=>"js:function(){alert('teste');
$('#test1').autocomplete({
source : 'http://localhost/kmcms/site/autocomplete?newparam=' + $('#dr :selected').text()
});
}"
),
));
?>
in the site controller
public function actionAutoComplete(){
$newparam = CHttpRequest::getParam('newparam',null);
//...do the rest
}
regards!
nacesprin
(Javierleal)
July 2, 2011, 1:57am
3
scoob.junior:
this can be a starting point
in the view
<?php
echo CHtml::dropDownList('dr',null,array('se', 'sel2', 'Item3'));
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'test1',
'options'=>array(
'search'=>"js:function(){alert('teste');
$('#test1').autocomplete({
source : 'http://localhost/kmcms/site/autocomplete?newparam=' + $('#dr :selected').text()
});
}"
),
));
?>
in the site controller
public function actionAutoComplete(){
$newparam = CHttpRequest::getParam('newparam',null);
//...do the rest
}
regards!
THANKS, SCOOB.JUNIOR. Your solution has solved me many headaches!!! thanks!