F
Filamentβ€’7mo ago
Wannes

Togglebuttons selects everything

Hi there! If I select one item in my ToggleButtons form component, for some weird reason it selects them all. Has anyone else experienced this issue?
ToggleButtons::make('days')
->label(__('integrations.track_and_trace.days_label'))
->live()
->grouped()
->options([
'monday' => __('integrations.track_and_trace.days.monday'),
'tuesday' => __('integrations.track_and_trace.days.tuesday'),
'wednesday' => __('integrations.track_and_trace.days.wednesday'),
'thursday' => __('integrations.track_and_trace.days.thursday'),
'friday' => __('integrations.track_and_trace.days.friday'),
'saturday' => __('integrations.track_and_trace.days.saturday'),
'sunday' => __('integrations.track_and_trace.days.sunday'),
])
ToggleButtons::make('days')
->label(__('integrations.track_and_trace.days_label'))
->live()
->grouped()
->options([
'monday' => __('integrations.track_and_trace.days.monday'),
'tuesday' => __('integrations.track_and_trace.days.tuesday'),
'wednesday' => __('integrations.track_and_trace.days.wednesday'),
'thursday' => __('integrations.track_and_trace.days.thursday'),
'friday' => __('integrations.track_and_trace.days.friday'),
'saturday' => __('integrations.track_and_trace.days.saturday'),
'sunday' => __('integrations.track_and_trace.days.sunday'),
])
Solution:
'days' => 'monday'
Jump to solution
16 Replies
LeandroFerreira
LeandroFerreiraβ€’7mo ago
Are you using the panel builder? Is it a custom page?
Wannes
WannesOPβ€’7mo ago
Custom page indeed
LeandroFerreira
LeandroFerreiraβ€’7mo ago
Did you create the mount method with $this->form->fill()? Are you using a statePath?
Wannes
WannesOPβ€’7mo ago
Yep Other fields in the form are working just fine
LeandroFerreira
LeandroFerreiraβ€’7mo ago
console errors?
Wannes
WannesOPβ€’7mo ago
No πŸ˜…
LeandroFerreira
LeandroFerreiraβ€’7mo ago
please share the code..
Wannes
WannesOPβ€’7mo ago
Wannes
WannesOPβ€’7mo ago
the data array has this data
No description
LeandroFerreira
LeandroFerreiraβ€’7mo ago
do you mean, $this->settings?
Wannes
WannesOPβ€’7mo ago
Oh yes
LeandroFerreira
LeandroFerreiraβ€’7mo ago
days isn't multiple, so this should contain one value
Wannes
WannesOPβ€’7mo ago
Its multiple (forgot to add that in the first snippet), but it is as in the larger one
Solution
LeandroFerreira
LeandroFerreiraβ€’7mo ago
'days' => 'monday'
Wannes
WannesOPβ€’7mo ago
ooooh thanks its just an array that has to be saved with the values not an asociative array with true/false πŸ˜…
LeandroFerreira
LeandroFerreiraβ€’7mo ago
yes
Want results from more Discord servers?
Add your server