updateDropdown(this, $("#' . $form_name . '_birthplace_city_id"), data); }'))); ?> <?php echo CHtml::error($model, 'birthplace_state_id'); ?> </div> </div> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'birthplace_city_id', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <?php echo CHtml::activeDropDownList($model, 'birthplace_city_id', CHtml::listData(ReferenceGeoCities::model()->byOrder()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select', 'ajax' => array('type' => 'GET', 'url' => array('geography/cities/dynamicDistricts'), 'data' => array('id' => 'js:this.value'), 'success' => 'function(data){ updateDropdown(this, $("#' . $form_name . '_birthplace_district_id"), data); }'))); ?> <?php echo CHtml::error($model, 'birthplace_city_id'); ?> </div> </div> <div class="form-group"> <?php echo CHtml::activeLabelEx($model, 'birthplace_district_id', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <?php
?> <div class="col-md-6 col-xs-12"> <?php echo CHtml::activeDropDownList($address, 'state_id', CHtml::listData(ReferenceGeoStates::model()->byCountry($address->country_id)->byOrder()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select')); ?> <div id="errorState_id" class="errorMessage"></div> </div> </div> <div class="form-group"> <?php echo CHtml::activeLabelEx($address, 'city_id', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <?php echo CHtml::activeDropDownList($address, 'city_id', CHtml::listData(ReferenceGeoCities::model()->byState($address->state_id)->byOrder()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select')); ?> <div id="errorCity_id" class="errorMessage"></div> </div> </div> <div class="form-group"> <?php echo CHtml::activeLabelEx($address, 'district_id', array('class' => $label_class)); ?> <div class="col-md-6 col-xs-12"> <?php echo CHtml::activeDropDownList($address, 'district_id', CHtml::listData(ReferenceGeoDistricts::model()->byCity($address->city_id)->byOrder()->findAll(), 'id', 'name'), array('data-placeholder' => at('Please select one...'), 'prompt' => '', 'data-live-search' => 'true', 'class' => 'validate[required] form-control select')); ?> <div id="errorDistrict_id" class="errorMessage"></div> </div>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return ReferenceGeoCities the loaded model * @throws CHttpException */ public function loadModel($id) { $model = ReferenceGeoCities::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }