Ajax Post Problem with Dependent Dropdown

Hi,

I am new to Yii and Ajax and I am experimenting with the Dependent Dropdown cookbook example.  I've gotten it so that the POST happens, but comes back with a 405 Method not allowed. 

Firebug says that the post address is http://localhost/mya...dynamiccities.

Check this

http://bakakoneko.wo…r-in-firefox-3/

and this

http://forums.opengo…php?topic=426.0

Quote

Check this

http://bakakoneko.wo…r-in-firefox-3/

and this

http://forums.opengo…php?topic=426.0

I looked at those links, but I think I am too new to this all to understand how they can help me.  Are you saying that there is some change I need to make to IIS to allow the POST to go through to YII?

Thanks,

Greg

I mean, it's not the YII problem, seems like it's a well-known bug.

Two reasons may cause this: improperly configured server or incorrect request.

Check for both.

Hi,

It may be an IIS issue, but there is one thing that YII is doing that confuses me.  The dependent dropdown cookbook example includes this line:

    'url'=>'dynamiccities', //url to call

And this produces a POST to http://localhost/myApp/dynamiccities which fails with a 405 error.  I changed the line to this:

    'url'=>$this->createUrl('dynamiccities')

And this produces a POST to http://localhost/myA…l/dynamiccities which succeeds.

Is it possible this line is wrong in the cookbook or would changing something on my IIS settings allow the first post to succeed?

Thanks,

Greg

Quote

The dependent dropdown cookbook example includes this line:

    'url'=>'dynamiccities', //url to call

And this produces a POST to http://localhost/myApp/dynamiccities which fails with a 405 error.

I use Apache 2.2.11 and get the same result. But the following will generate http://localhost/myA…e/dynamiccities

CHtml::ajaxLink('submit', array(dynamiccities), array('type'=>'POST','update'=>'#result',));

I think the behavior of dropDownList and ajaxLink should be the same, right?

btw, I'm using this now, it works.

<?php echo CHtml::dropDownList('country_id','',array(1=>'USA',2=>'France',3=>'Japan'),


array(


'ajax' => array(


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


'url'=>'index.php?r=site/dynamiccities', //url to call


'update'=>'#city_id', //selector to update


//'data'=>'js:javascript statement' 


))); ?>

I don't know where should be written the actionDynamiccities() method. I have a form for customer, for example, in this I have country dropdown, state dropdown and city dropdown, what do I need to add to the city model &/or controller, what in state, and what in country. In the form I have CHtml::activeDropDownList($customer,'laboraladdress_idcountry'… is this ok to have the $customer, why is not here? Do you have a clear example with what should be added on the (user/create) view what in the controller, and what in the model/s.

THanks in advance.