/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = IslandGroup::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['island_id' => $this->island_id]); $query->andFilterWhere(['like', 'island_name', $this->island_name]); return $dataProvider; }
?> <div class="region-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'region_name')->textInput(['maxlength' => true]); ?> <?php $islandgroup = IslandGroup::find()->all(); $listData = ArrayHelper::map($islandgroup, 'island_id', 'island_name'); echo $form->field($model, 'island_id')->dropDownList($listData, ['prompt' => 'Select Island where you belong']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>