Hi guys,
I am having a problem with AJAX query.
I need to implement the following functionality:
User is choosing a value in activeDropDownList I am passing this value to controller via ajax request and according to this value, controller should change
value of activeTextField(for example make it disabled and assign text to value field.)
I was making my research based on the following article from Yii Cook Book http://www.yiiframework.com/doc/cookbook/24/, it’s a little bit different from
what I am trying to achieve but I’ve took a concept from there.
So this is my activeDropDownList
<?php echo CHtml::activeDropDownList($model,'fromtype',CHtml::listData( policygrouptype::model()->findAll(), 'id', 'description' ),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>'index.php?r=policy/dynamicinput', //url to call
'update'=>'#policy_fromvalue', //selector to update
//'data'=>'js:javascript statement'
//leave out the data key to pass all form values through
)
));?>
And here is my activeTextField which should be changed dynamicly.
<?php echo CHtml::activeTextField($model,'fromvalue',array('size'=>60,'maxlength'=>250,'id'=>'policy_fromvalue')); ?>
So can anyone help me in writing functionality for the controller to achieve my goal, so far I have an impression that my ajax query is not working, since
no new Jquery event handler can be detected on a page, I am using Firebug for monitoring this.
I had also an impression that something should be turned on in Yii config file to enable AJAX requests.
Thanks for your help.