Yii Framework Forum: Strange Ajax behaviour - Yii Framework Forum

Jump to content

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

Strange Ajax behaviour a [form] a dropdownlist using ajax to feed 2nd dropdownlist [/form] Rate Topic: -----

#1 User is offline   tydeas_dr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 158
  • Joined: 16-April 10
  • Location:Greece

Posted 04 May 2010 - 07:37 AM

Hello ppl,
First topic to the forum after a big issue i haven't solved. So let's begin. I have this _pform.php
[code ] <div class="row" id="address<?php echo $i;?>">


<?php

echo CHtml::dropDownList('cnid'.$i,'',CHtml::listData(Country::model()->findAll(),'cnid','cname'),
array('prompt'=>'Select Country...','ajax' => array(
'type'=>'GET', //request type
'url'=>CController::createUrl('/country/getcities&param='.$i), //url to call
'update'=>'#Address_'.$i.'_tid', //selector to update

//leave out the data key to pass all form values through
)));

////empty since it will be filled by the other dropdown

//echo $form->labelEx($address,'tid');
//echo CHtml::dropDownList('Adffgghghgs_tid','', array(),array('prompt'=>'Select Town...'));

//echo $form->dropDownList($address,"[$i]tid",array(),array('prompt'=>'Select town..'));
echo CHtml::activeDropDownList($address,"[$i]tid",array(),array('prompt'=>'Select town..'));
//echo $form->error($address,'tid');
echo CHtml::error($address,'tid');
//echo $form->textField($address,"[$i]street",array('size'=>45,'maxlength'=>45));
echo CHtml::activeTextField($address,"[$i]street",array('size'=>45,'maxlength'=>45));
//echo $form->error($address,'street');
echo CHtml::error($address,'street');
//echo $form->textField($address,"[$i]zip");
echo CHtml::activeTextField($address,"[$i]zip");
//echo $form->error($address,'zip');
echo CHtml::error($address,'zip'); ?>

</div>
<?php $i++; ?>
<div class="row" id="address<?php echo $i;?>">
</div>

<div class="row">
<?php //$jsonadd=CJSON::encode($address); ?>
<?php echo CHtml::ajaxLink("label",$this->createUrl('address/moreadd&i='.$i),array('update'=>'#address'.$i ));?>
</div>[/code] (sorry for the uneccessary comments and my bad English )
So it when this form renders for 1st time the first dropdownlist behaves as it supposed to. The request is send the result received.
When i press the label ajaxLink a 2nd form renders (as it supposed) the problem now.
In the 2nd form rendered the ajax of the 1st dropdown list does not behave as it supposed ( it does not feed the second dropdown.
I used firebug and noticed that the request is not send and obviously a result is not coming.
Any help will be appriciate.
Follow me on twitter @dmtrsslvdr
Check my *new* blog @ tumblr
0

#2 User is offline   tydeas_dr 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 158
  • Joined: 16-April 10
  • Location:Greece

Posted 04 May 2010 - 05:46 PM

Well. I didn't explain proper the issue I had. It's that the $processOutput variable of the renderPartial() called by ajax should be true.
I am reading http://www.yiiframew...ssOutput-detail
The documentation says "If there are registered client scripts, this method will insert them into the output at appropriate places.".
What does he mean by "...appropriate places." , What is this places?
Friendly,
_tydeas_
Follow me on twitter @dmtrsslvdr
Check my *new* blog @ tumblr
0

#3 User is offline   Onman 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 175
  • Joined: 26-December 09
  • Location:The Netherlands

Posted 04 May 2010 - 05:55 PM

This should answer your question:

http://www.yiiframew...erScript-detail
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