Strange Ajax behaviour

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 [color="#FF0000"][/color]] <div class="row" id="address<?php echo $i;?>">

            &lt;?php 





            echo  CHtml::dropDownList('cnid'.&#036;i,'',CHtml::listData(Country::model()-&gt;findAll(),'cnid','cname'),


                    array('prompt'=&gt;'Select Country...','ajax' =&gt; array(


                        'type'=&gt;'GET', //request type


                        'url'=&gt;CController::createUrl('/country/getcities&amp;param='.&#036;i), //url to call


                        'update'=&gt;'#Address_'.&#036;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 &#036;form-&gt;labelEx(&#036;address,'tid');


            //echo CHtml::dropDownList('Adffgghghgs_tid','', array(),array('prompt'=&gt;'Select Town...'));


            


            //echo &#036;form-&gt;dropDownList(&#036;address,&quot;[&#036;i]tid&quot;,array(),array('prompt'=&gt;'Select town..'));


            echo CHtml::activeDropDownList(&#036;address,&quot;[&#036;i]tid&quot;,array(),array('prompt'=&gt;'Select town..'));


            //echo &#036;form-&gt;error(&#036;address,'tid');


            echo CHtml::error(&#036;address,'tid');  


            //echo &#036;form-&gt;textField(&#036;address,&quot;[&#036;i]street&quot;,array('size'=&gt;45,'maxlength'=&gt;45));


            echo CHtml::activeTextField(&#036;address,&quot;[&#036;i]street&quot;,array('size'=&gt;45,'maxlength'=&gt;45));


	//echo &#036;form-&gt;error(&#036;address,'street');


            echo CHtml::error(&#036;address,'street'); 


            //echo &#036;form-&gt;textField(&#036;address,&quot;[&#036;i]zip&quot;);


            echo CHtml::activeTextField(&#036;address,&quot;[&#036;i]zip&quot;);


            //echo &#036;form-&gt;error(&#036;address,'zip');


	echo CHtml::error(&#036;address,'zip'); ?&gt;


            


&lt;/div&gt;


        &lt;?php &#036;i++; ?&gt;


    &lt;div class=&quot;row&quot; id=&quot;address&lt;?php echo &#036;i;?&gt;&quot;&gt;


    &lt;/div&gt;


    


    &lt;div class=&quot;row&quot;&gt;


        &lt;?php //&#036;jsonadd=CJSON::encode(&#036;address); ?&gt;


        &lt;?php echo CHtml::ajaxLink(&quot;label&quot;,&#036;this-&gt;createUrl('address/moreadd&amp;i='.&#036;i),array('update'=&gt;'#address'.&#036;i ));?&gt;


    &lt;/div&gt;[/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 [color="#FF0000"]2nd form[/color] 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.

Well. I didn’t explain proper the issue I had. It’s that the [color="#8B0000"]$processOutput [/color]variable of the renderPartial() called by ajax should be [color="#0000FF"]true[/color].

I am reading http://www.yiiframework.com/doc/api/1.0.10/CController#processOutput-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

This should answer your question:

http://www.yiiframework.com/doc/api/CClientScript#registerScript-detail