FilamentF
Filament3y ago
Tur

Custom text form fields as array

Hi there. I would appreciate a hint to handle textfields that represent percentages per each day of the week.

Forms\Components\TextInput::make('timetable[1]')->label('Monday')->default(100),
Forms\Components\TextInput::make('timetable[2]')->label('Tuesday')->default(100),
Forms\Components\TextInput::make('timetable[3]')->label('Wednesday')->default(100),
....

timetable field is a text field and upon saving i want to serialize array as 1=>100, 2=>100, 3=>100 ....
and btw default here doesnt work - it won't display 100 as a value.
Was this page helpful?