Here’s a small tip on how to create a hidden field in an active record form, within the model:

<?php $form = ActiveForm::begin(); ?>

<?= $form->field($model, ‘fullname’)->textInput([‘maxlength’ => true]) ?>

/* Example of hiddenInput for an ActiveRecord Active $form->field */
<?= $form->field($model, ‘state’)->hiddenInput([‘value’=> $src->state])->label(false);?>

<?= $form->field($model, ‘position_str’)->textInput([‘maxlength’ => true]) ?>

<?php ActiveForm::end(); ?>

Support this site, share this page:Share on twitter

Twitter

Share on reddit

Reddit

Share on linkedin

Linkedin

Share on facebook

Facebook

Share on email

Email