F
Filamentβ€’3mo 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β€’3mo ago
Are you using the panel builder? Is it a custom page?
Wannes
Wannesβ€’3mo ago
Custom page indeed
LeandroFerreira
LeandroFerreiraβ€’3mo ago
Did you create the mount method with $this->form->fill()? Are you using a statePath?
Wannes
Wannesβ€’3mo ago
Yep Other fields in the form are working just fine
LeandroFerreira
LeandroFerreiraβ€’3mo ago
console errors?
Wannes
Wannesβ€’3mo ago
No πŸ˜…
LeandroFerreira
LeandroFerreiraβ€’3mo ago
please share the code..
Wannes
Wannesβ€’3mo ago
Wannes
Wannesβ€’3mo ago
the data array has this data
No description
LeandroFerreira
LeandroFerreiraβ€’3mo ago
do you mean, $this->settings?
Wannes
Wannesβ€’3mo ago
Oh yes
LeandroFerreira
LeandroFerreiraβ€’3mo ago
days isn't multiple, so this should contain one value
Wannes
Wannesβ€’3mo ago
Its multiple (forgot to add that in the first snippet), but it is as in the larger one
Solution
LeandroFerreira
LeandroFerreiraβ€’3mo ago
'days' => 'monday'
Wannes
Wannesβ€’3mo ago
ooooh thanks its just an array that has to be saved with the values not an asociative array with true/false πŸ˜…
LeandroFerreira
LeandroFerreiraβ€’3mo ago
yes