Hi All,
there is a form which has got two CJuiAutoComplete widget.
first one is running well. but i want to create an second autocomplete widget that it’s source url with first one’s selected value. i tried many ways but i couldnt run it.
Have an idea?
<div class="row">
<?php echo $form->labelEx($model,'name');
echo '<font style="color:#BDBDBD;">Örn. ASPİRİN</font><br />';
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'drugname',
'value'=>$drug_name_label,
'source'=>CController::createUrl('/agricultureDrug/drugnamelookup'),
'options'=>array(
'showAnim'=>'fold',
'minLength'=>'2',
'select'=>'js:function( event, ui ) {
$("#drugname").val( ui.item.label );
$("#AgricultureDrug_name").val( ui.item.value );
return false;
}',
),
'htmlOptions'=>array(
'onfocus' => 'js:if(this.value != "") { this.value = null; $("#AgricultureDrug_name").val(null);}',
'style'=>'height:20px; width:400px;',
),
));
echo CHtml::activeHiddenField($model,'name');
?>
</div>
this is ok. running well…
how have to be the second one’s source code?
'source'=>CController::createUrl('/agricultureDrug/drugformlookup?id=i dont know here')
id value is first one’s selected value… so what is the code for “i dont know here”?
or
this method will be wrong… so any other way?
<div class="row">
<?php echo $form->labelEx($drugform,'drug_form_name');
echo '<font style="color:#BDBDBD;">Örn. Tablet 100 mg, Şurup 120 mg/5 ml, Kapsül</font><br />';
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'drugformname',
'value'=>'',
'source'=>CController::createUrl('/agricultureDrug/drugformlookup?id='),
'options'=>array(
'showAnim'=>'fold',
'minLength'=>'2',
'select'=>'js:function( event, ui ) {
$("#drugformname").val( ui.item.label );
$("#AgricultureDrugForm_drug_form_names").val( ui.item.val );
return false;
}',
),
'htmlOptions'=>array(
'style'=>'height:20px; width:400px;',
),
));
echo CHtml::activeHiddenField($drugform,'drug_form_name');
?>
</div>