Textfield Update After Dropdownlist Selection In Cactiveform

Hello Yiianswers!

Here’s my problem…

In my view I need a textfield from Cactiveform to change when the user selects a value from a dropdownlist.

The dropdownlist gets its value from a model (users) and that value is passed to the controller so I can do some db query.

After i pass that value from the dropdownlist to the controller y get the value I need to return to the view.

The function works and I get the value but I don’t know how to update the text field with that value. here is the code i’m using.

Thanks in advance.

The view:

          ///This is the Dropdownlist


    <div id="droplat "class="row">


            echo $form->labelEx(Users::model(),'De User'); ?>


            echo $form->dropDownList(Users::model(),'users_idusers', CHtml::listData(Users::model()->findAll(), 'users_idusers', 'users_username'),


                 'prompt'=>'---Select Usuario ---',


                 'type'=>'POST', //request type

                 'url'=>CController::createUrl('getajaxdatafrom'), //url to call.



 'update'=>'#' . CHtml::activeId($model,'log_latfrom'),

                 'data'=>array('elvalor' => 'js:this.value'),





        ///This is the Textfield i need to update with the value $lon from 

        /// the controller


	<div class="row">

    <?php echo $form->labelEx($model,'log_latfrom'); ?>

    <?php echo $form->textField($model,'log_latfrom',array('size'=>45,'maxlength'=>45)); ?>

    <?php echo $form->error($model,'log_latfrom'); ?>


The Controller:

         public function actionGetAjaxDataFrom()


        $Criteria = new CDbCriteria();

$Criteria->condition = "usergeolog_userid=".$_POST['elvalor'];

$data = Usergeolog::model()->findAll($Criteria);

foreach ($data as $dat) {




    echo CHtml::tag('Log_log_latfrom', array( 'type'=>'text' , 'value' => $lon));



as you can see in the controller I use

echo CHtml::tag(‘Log_log_latfrom’, array( ‘type’=>‘text’ , ‘value’ => $lon));

I think this is the problem… I use Log_log_latfrom becouse I believe that is the id of the activetextfield in the view …

Thanks again…