0
I have a form that will need duplicity. It is an academic form.
In this form, it contains the following attributes, according to my model:
class Academico extends \app\models\MainModel
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'academico';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['member_id', 'instituicao', 'data_inicio', 'data_termino', 'cidade', 'estado', 'tipo'], 'required'],
[['member_id', 'data_inicio', 'data_termino'], 'integer'],
[['instituicao', 'cidade', 'estado', 'serie', 'curso', 'tipo'], 'string', 'max' => 191],
[['member_id'], 'exist', 'skipOnError' => true, 'targetClass' => Usuario::className(), 'targetAttribute' => ['member_id' => 'id']],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'member_id' => 'Member ID',
'instituicao' => 'Instituicao',
'data_inicio' => 'Data Inicio',
'data_termino' => 'Data Termino',
'cidade' => 'Cidade',
'estado' => 'Estado',
'serie' => 'Serie',
'curso' => 'Curso',
'tipo' => 'Tipo',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getMember()
{
return $this->hasOne(Usuario::className(), ['id' => 'member_id']);
}
}
In my view, the attributes I upload are: 'institution', 'data_start', 'data_termino', 'city', 'state'.
I need to duplicate all these attributes without having to add one by one, as it is in the image:
My view: `
<?php $form = ActiveForm::begin(
['id'=>'form-academico']
); ?>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'instituicao')->widget(MultipleInput::className(['cloneButton' => true,])); ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'data_inicio')->widget(MultipleInput::className()); ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'data_fim')->widget(MultipleInput::className()); ?>
</div
<?php ActiveForm::end(); ?>
</div>
`