public function actionAjaxState() { $country = country::model()->findByPk($_POST['address']['address_country_ID']); if ($country && $country->contain_states == 1) { echo CHtml::dropDownList('address[address_state_ID]', '', state::items($country->country_ID), array('id' => 'state')); } else { echo CHtml::dropDownList('address[address_state_ID]', '', array(0 => '----------------------------------------'), array('id' => 'state')); } }
public function loadModel() { if ($this->_model == null) { if (isset($_GET['id'])) { $condition = ''; $this->_model = country::model()->findByPk($_GET['id'], $condition); } if ($this->_model == null) { throw new CHttpException(404, "The requested page does not exist!"); } } return $this->_model; }