public function findYiiInputsById($id) { return YiiInputs::find()->where(['id' => $id]); }
<?php echo $form->field($model, '[0]label')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, '[1]type')->dropDownList(ArrayHelper::map(YiiInputs::find()->all(), 'name', 'name')); ?> <?php echo $form->field($model, '[1]label')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, '[2]type')->dropDownList(ArrayHelper::map(YiiInputs::find()->all(), 'name', 'name')); ?> <?php echo $form->field($model, '[2]label')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php
/** * Finds the YiiInputs model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return YiiInputs the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = YiiInputs::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
</h1> <h1>Category : <?php echo Html::encode($model->category); ?> </h1> <?php echo Html::hiddenInput('form-id-input', $model->id, ['id' => 'form-id']); ?> <div class="forms-form"> <div class="edit-wrapper-input"> <?php echo Html::label(Yii::t('app', 'Field Type'), 'add-field'); echo Html::dropDownList('add-field', Yii::t('app', 'Select Field'), ArrayHelper::map(YiiInputs::find()->all(), 'name', 'options'), ['class' => 'form-control form-edit', 'id' => 'add-field']); echo Html::label(Yii::t('app', 'Field Name'), 'add-label'); echo Html::textInput('add-label', null, ['class' => 'form-control form-edit', 'id' => 'add-label']); ?> <br> <?php echo Html::button('+', ['class' => 'btn btn-primary', 'id' => 'add-field-ajax']); ?> <br> <br> <input type="hidden" name="hiddenField"/> <?php echo Html::beginForm(); ?> <?php if (!empty($relatedFields)) {