loading_personality
Custom Field: Using Form Components
As the title says, i want make use of filament components like a select, inside my custom filament field, how can i achieve that?
i tried using HasForm Contract , and InteractsWithForm but it wasn't successful.
any suggestions?
7 replies
Help with dependable select
I've a dependable select 'province' that depends on the select 'country', both of the inputs are nested within a repeater.
the problem is with the province select, as you can see in the code, if i set the fallback return value for options to ` it works as expected (but it leave an extra padding space under the placeholder) but if i simply return an empty array, the select wouldn't react or change when i change the country, can anyone explain please?
here's the code;
```php
Select::make('country_id')
->label('Pays')
->options(CoreCountry::pluck('name', 'id'))
->native(false)
->searchable()
->live()
->afterStateUpdated(function ($get, $set, $livewire) {
$set('province_id', null);
}),
Select::make('province_id')
->label('Province')
->options(function ($get) {
$country_id = $get('country_id');
if ($country_id) {
return CoreProvince::where('country_id', $country_id)->pluck('name', 'id');
} else {
return ['' => ''];
}
})
->searchable(),
3 replies
How to get other repeaters items
I have a repeater item containing a Toggle, i want only one toggle in the repeater item list to be active at a time, so if the user checks a toggle i want to use *afterStateUpdated *and set all the other toggle in the repeater to false, i tried to use the $get Closure but i don't know what to put in the selector since the $get of a repeater is relative to the item itself, i'm new to Filament, any help would be appreciated.
4 replies