ho messo questo nel model Profile.php
//Ajax Upgrade
public function actionACountry()
{
$this->render('update');
}
public function actionAcity()
{
$arrCity = array(
'1'=>array('1'=>'NY', '2'=>'Bosston', '3'=>'DC'),
'2'=>array('1'=>'Paris', '2'=>'Versailles', '3'=>'Nice'),
'3'=>array('1'=>'Tokyo', '2'=>'Osaka', '3'=>'Nagoya'),
);
@$intCid = (int)$_POST['country_id'];
if (!empty($intCid))
foreach ($arrCity[$intCid] as $key=>$cityName)
echo CHtml::tag('option',
array('value'=>$key),
CHtml::encode($cityName),
true
);
}
e nella mia view update.php
echo CHtml::dropDownList(
'country_id',
'',
array('0'=>'Choice One',
'1'=>'USA',
'2'=>'France',
'3'=>'Japan',),
array(
'ajax'=>array(
'type'=>'POST',
'url'=>CController::createUrl('profile/acity'),
'update'=>'#city_id'
// ‘data’=>‘js:javascript statement’,
)));
echo CHtml::dropDownList('city_id','',array('Country First'));
ma non fa assolutamente nulla sapete aiutarmi?
grazie mille