Open moham96 opened 1 year ago
if you want you can use $form-hidden field or $form->saving(function{ //your codes });
if you want you can use $form-hidden field or $form->saving(function{ //your codes });
Maybe I didn't phrase it correctly, what I meant is to show it to the user, not set it during saving.
if I use
$form->text('dep', 'department')->readonly()->value($department);
then it shows the value of $department
which is expected:
but in the case of a select you may have an array of value=>name like:
$options=[
'engineer'=>'engineering department',
]
so I want to show the user the select menu and choose a specific option(show the name and set the value.
The only workaround I can think of is using a text field and setting it to the name of the option and then overriding it in 'saving' to the value, but it seems hacky. and would prefer to show a select menu and not a text field. Regards
İnspect to this bro.
$myDBTable=DB::select('select * from sigortalars'); foreach ($myDBTable as $row) {$myArrayData[$row->id] = $row->sigorta_adi; } $form->select('user', __('Choose User'))->options($myArrayData);
Yo dont forget import use DB;
Description:
I have a select field that I would like to set it's value to a pre-defined one and make it read-only, this is possible with text fields but not select fields. How can I select a specific option in a select field?
Regards