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.
2 Replies
you could use repeater to do this.
What is exact issue you are having, does the state not write to timetable[1] ? have you tried timetable.1 ?
Sorry just bit confused π
Hello. Thank You it was about the notation timetable.1. When tried timetable[1] it looked for a field with that name in db π