public function actionDestinationstatesAdd() { $intCountry = Yii::app()->getRequest()->getQuery('country_id'); foreach (State::getStatesForTaxes($intCountry) as $key => $val) { echo CHtml::tag('option', array('value' => $key), CHtml::encode($val), true); } }
?> <?php echo $form->dropDownList($model, 'country', Country::getCountriesForTaxes(false), array('ajax' => array('type' => 'GET', 'url' => CController::createUrl('shipping/Destinationstatesadd'), 'update' => '#' . CHtml::activeId($model, 'state'), 'data' => 'js:{"' . 'country_id' . '": $("#' . CHtml::activeId($model, 'country') . ' option:selected").val()}'))); ?> <?php echo $form->error($model, 'state'); ?> </div> </div> <div class="row"> <div class="span5"> <?php echo $form->labelEx($model, 'state'); ?> <?php echo $form->dropDownList($model, 'state', State::getStatesForTaxes($model->country), array('prompt' => '--', 'ajax' => array('type' => 'POST', 'dataType' => 'json', 'data' => 'js:{"' . 'state_id' . '": $("#' . CHtml::activeId($model, 'state') . ' option:selected").val() }'))); ?> <?php echo $form->error($model, 'state'); ?> </div> </div> <div class="row"> <div class="span3"><label>Optional</label> <?php echo $form->labelEx($model, 'zipcode1'); ?> <?php echo $form->textField($model, 'zipcode1');