Ok, i’ve been turning myself inside out for a couple of days, and ive tried all the tutorials, copied others code, and I just cant do it.
Im looking for a guide that will tell me exactly how to make a field use the autocomplete facility which grabs all the distinct values in a DB column, and allow that all to work within an create and update form…
e.g
Put <? xyz ?> in controllers/LeadsController.php
Put <? xyz ?> in leads/_form.php
Install xyz into extensions/…
I can at least get it to show the appropriate value from a column, I cant get it to create a dynamic list to choose from.
e.g. in my _form ive got currently (and have had millions of attempts, I dont know what worked and what didnt now
<? echo $form->textField($model,'client_address_town',array()); ?>
<?
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'model'=>$model,
'attribute'=>'client_address_town',
'source'=>$this->createUrl('leads/update'),
// additional javascript options for the autocomplete plugin
'options'=>array(
'showAnim'=>'fold',
'select'=>"js:function(event, ui) {
$('#Leads_client_address_town').val(ui.item.id);
}"
),
'cssFile'=>false,
));
?>
Where’s Obi Wan Kenobi when you need him.