Closed ghost closed 2 years ago
Can you please show an example of the data you passed to the :options
prop.
From the sample you posted, your $provinces
in :options
should be array like the following with array keys specified in
value-field
and text-field
props;
$provinces = [
['id' => '1', 'name' => 'Delta'],
['id' => '2', 'name' => 'Edo'],
['id' => '3', 'name' => 'Enugu'],
['id' => '4', 'name' => 'Lagos'],
];
and the selected value in $municipality->province_id
should be a value of the province ID e.g 2 for for
Edo`.
if you are using the simple-select
in Livewire component, use wire:model
instead of :value
this is how I fill the options. the columns are id and name;
$provinces = Province::orderBy('name')->get()->toArray();
I somehow found the problem, when I copy your example it work as you said but when I change the id
from string
to int
it doesn't work anymore, since the id
on my $provinces
is int
.
I just fixed this issue in v1.2.5, you can now use int
as id
.
Thank you! Working perfectly now.
I'm trying to use the select on my edit page, so far I manage to use multiple by passing an array of id to value.
controller.php
edit.blade.php
But the above code won't work in normal select, I try passing the id or the name directly but nothing would show.
I'm still new to TALL so I don't understand anything when I read your code, wish you could help.