Heres he Main Model EVR _form.php
############################################################################################
<?php
#use yii\helpers\Html;
#use yii\widgets\ActiveForm;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\helpers\Html;
use app\models\EvrInformants;
/* @var $this yii\web\View */
/* @var $model app\models\Evr */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="evr-form">
<?php $form = ActiveForm::begin(); ?>
<?php
echo Form::widget([
'model' => $model,
'form' => $form,
'columns' => 3,
'attributes' => [
'name' => ['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter Name...',]],
'position' => ['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter Position...',]],
'phone_number' => ['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter Phone Number...',]],
]
]);
echo Form::widget([
'model' => $model,
'form' => $form,
'columns' => 3,
'attributes' => [
'years_in_service' => ['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter Years of Service...',]],
'present_position' => ['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter Present Position...',]],
'salary' => ['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter Salary...',]],
]
]);
echo Form::widget([
'model' => $model,
'form' => $form,
'columns' => 1,
'attributes' => [
'remarks' => ['type'=>Form::INPUT_TEXTAREA, 'options'=>['placeholder'=>'Write Remarks...',]],
]
]);
?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
###########################################################################
here’s the Second Model EVR_iformants _form.php
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\EvrInformants */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="evr-informants-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => 100]) ?>
<?= $form->field($model, 'evr_id')->textInput(['maxlength' => 10]) ?>
<?= $form->field($model, 'position')->textInput(['maxlength' => 100]) ?>
<?= $form->field($model, 'phone_number')->textInput(['maxlength' => 20]) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
##################################################################################################
attach is what i want to happen.
CREATE EVR is the MAIN MODEL… I ADD The Name, Position and Phone Number in the create form for multiple inserts in models…
NOW, When i got to Index.php when i click the update action( The Pencil Icon.) i want the data from the EVR_informants ( the second Model ) to be pass back from the EVR Form… for update…