<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'user-form', 'enableAjaxValidation' => false)); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <label>Court</label> <?php echo $form->dropDownListControlGroup($model, 'master_id', CHtml::listData(Court::model()->findAllByAttributes(array('state_id' => 32, 'district_id' => 535), array('order' => 'name ASC')), 'id', 'name'), array('empty' => '---Select Court---', 'span' => 5, 'label' => false)); ?> <?php echo $form->textFieldControlGroup($model, 'name', array('span' => 5, 'maxlength' => 45)); ?> <?php echo $form->textFieldControlGroup($model, 'email', array('span' => 5, 'maxlength' => 45)); ?> <?php echo $form->textFieldControlGroup($model, 'mobile', array('span' => 5, 'maxlength' => 45)); ?> <?php
?> <?php echo $form->textFieldControlGroup($model, 'police_station_id', array('span' => 5)); ?> <div id="select_district" > <label>Select District</label> <?php //echo $form->dropDownList($model,'district_id',CHtml::listData(District::model()->findAllByAttributes(array('states_id'=>$model->state_id),array('order' => 'name ASC')), 'id', 'name'),array('empty'=>'---Select State first---','span'=>5)); ?> <?php echo $form->dropDownList($model, 'state_id', CHtml::listData(States::model()->findAllByPk(array(19, 7, 32)), 'id', 'name'), array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('placeOfPosting/courts'), 'update' => '#PlaceOfOffence_court_id', 'data' => array('state_id' => 'js:this.value')), 'empty' => 'Select District'), array('span' => 5)); ?> </div> <?php echo $form->dropDownListControlGroup($model, 'court_id', CHtml::listData(Court::model()->findAll(array('order' => 'id ASC')), 'id', 'name'), array('span' => 5)); ?> <div class="form-actions"> <?php echo TbHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'size' => TbHtml::BUTTON_SIZE_LARGE)); ?> </div> <?php $this->endWidget(); ?> </div><!-- form -->
?> </td> <td><?php echo $v->date_time_offence; ?> </td> <td><?php echo $v->licence_no; ?> </td> <td><?php echo $v->name_person; ?> </td> <td><?php $court = Court::model()->findByPk($v->placeOfOffence->court_id); echo $court->name; ?> </td> </tr> <?php } ?> <tr> <td colspan='7'> <center><textarea name="dispatch[message]" placeholder="Enter Dispatch Comments (optional)" style="width:600px;"></textarea> <input type="submit" value="Dispatch" class="btn btn-success" ></center> </td> </tr> <?php
public function actionCourts() { //print_r($_POST);exit; if (!empty($_POST['state_id'])) { $data = Court::model()->findAllByAttributes(array("state_id" => array($_POST['state_id']))); //print_r($data);exit; foreach ($data as $value => $name) { echo CHtml::tag('option', array('value' => $name->id), CHtml::encode($name->name), true); } } }
public function actionCourts() { //print_r($_POST);exit; $data = Court::model()->findAllByAttributes(array("district_id" => array($_POST['district']))); foreach ($data as $value => $name) { echo CHtml::tag('option', array('value' => $value), CHtml::encode($name->name . " - " . $name->judge_code), true); } }
/** * 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 Court the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Court::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }