Hello everyone,
Maybe I’m missing something really simple, but how can I put related data in a textInput when the update form is loaded?
I usually do this with dropDownLists, but in this case I just need to display an attribute related to the current model (and just as a readonly that doesn’t need to be modified), so I think a dropdownn in unnecessary.
<?= $form->field($model, 'insumo_id')->textInput() ?>
insumo_id is a FK in the model, but I need to display insumo.descripcion. How can I make use of the existing relation?
Thanks!
Hello everyone,
Maybe I’m missing something really simple, but how can I put related data in a textInput when the update form is loaded?
I usually do this with dropDownLists, but in this case I just need to display an attribute related to the current model (and just as a readonly that doesn’t need to be modified), so I think a dropdownn in unnecessary.
<?= $form->field($model, 'insumo_id')->textInput() ?>
insumo_id is a FK in the model, but I need to display insumo.descripcion. How can I make use of the existing relation?
Thanks!
Well if you want to get a little creative, you can mess with the label or hints:
<?= $form->field($model, 'insumo_id')->textInput()->hint( 'description '. $model->insumo_description )->label('description '. $model->insumo_description) ?>
OR you can simply echo out the variable:
<?= $model->insumo_description; ?>
<?= $model->description; ?>