Thyds
(Nahu Rasero)
January 16, 2017, 1:18pm
1
Hi guys!
What I want to do is simple, but i can´t find how haha
Just get the selected value from the DropdownList and set it to the input T.T
<?= $form->field($model, 'wk_liq_ana_cli_actoid') -> textInput(['type' => 'number', 'maxlength' => true]) -> hiddenInput(['value' => HERE I WANT THE SELECTED VALUE]) ->label(false) ?>
<?= $form -> field($model, 'wk_liq_ana_cli_actodesc') -> widget(Select2::classname(), [
'data' => ArrayHelper::map(MacheoAnalisisClinicos::find()->all(), 'actodesccompania', 'actodesccompania'),
'language' => 'es',
'options' => ['placeholder' => 'Seleccione un acto...'],
'pluginOptions' => [
'allowClear' => true
],
]); ?>
Thanks thanks thanks!
Hi Thyds,
For initial DOM load use this code
<?= $form->field($model, 'wk_liq_ana_cli_actoid') -> textInput(['type' => 'number', 'maxlength' => true]) -> hiddenInput(['value' => $model->wk_liq_ana_cli_actodesc]) ->label(false) ?>
Add on change event like this below.
echo $form->field($model, 'wk_liq_ana_cli_actodesc')->dropDownList(
ArrayHelper::map(MacheoAnalisisClinicos::find()->all(), 'actodesccompania', 'actodesccompania'),
[
'prompt'=>'Seleccione un acto...',
'onchange'=>'$("#YOUR_MODEL_NAME[wk_liq_ana_cli_actoid]").val(this.value);' //OR Place the right jquery selector for the field wk_liq_ana_cli_actoid
]
);
I hope the above codes may help you.
Cheers! Happy Coding.
Thyds
(Nahu Rasero)
January 17, 2017, 11:23am
3
Thanks thanks thanks! It works
Happy coding too!