Yii Framework Forum: Ajax is not working properly - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ajax is not working properly ajax is not updating update=>"field" Rate Topic: -----

#1 User is offline   ps_sach 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 07-December 09

Posted 12 April 2010 - 12:16 AM

Hi there,

I am using Ajax and this is my code.


/*----------------   View page Code  -------------------------*/

echo CHtml::activeTextField($model,'UserName', 
array(
'id'=>'UserName',
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('CrmTicket/dynamiccities'), //url to call
'update'=>'#FullName', //selector to update

))); 
 

 echo CHtml::activeTextField($model,'FullName','',array('id'=>'FullName'));


/*------------------   CrmTicketController code   -----------------------------*/

public function actionDynamiccities()
{
    echo "test";
}




and now what I want is When you enter anything in UserName field it should fill the textfield "Fullname" with value "test" but it is not working. both fields are present in my model and safe attribute also.

can anybody help me

thanks in advance
0

#2 User is offline   oxigen 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 05-February 09

Posted 12 April 2010 - 01:01 AM

You must update value of form element. You can try:
echo CHtml::activeTextField($model,'UserName', 
array(
'id'=>'UserName',
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('CrmTicket/dynamiccities'), //url to call
'update'=>'#FullName', //selector to update
'success'=>'js:function(value){jQuery("#FullName").attr(\'value\', value)}',
))); 

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users