F
Filament10mo ago
torriv

Undefined array key "recordId"

I read this thread: https://discord.com/channels/883083792112300104/1108254033795362896 but couldn't find a solution for my problem, even if it's the same error. The error is appearing when i try to save. my headerActions code is:
->headerActions([
Tables\Actions\AttachAction::make()
->label('Legg til øvelse i program')
->recordSelect(fn () => Select::make('exercise_name')
->searchable()
->preload()
->createOptionForm([
Forms\Components\TextInput::make('exercise_name'),
])
->createOptionUsing(function ($data){
$exercise = WorkoutExercise::create($data);
return $exercise->getKey();
})
->options(WorkoutExercise::pluck('exercise_name', 'id'))
)
->form(fn (AttachAction $action): array => [
$action->getRecordSelect(),
Forms\Components\TextInput::make('repetitions')->required(),
Forms\Components\TextInput::make('sets')->required(),
Forms\Components\TimePicker::make('rest')
->native(false)
->secondsStep(10)
->displayFormat('i:s')
->format('H:i:s')
->required(),
])
])
->headerActions([
Tables\Actions\AttachAction::make()
->label('Legg til øvelse i program')
->recordSelect(fn () => Select::make('exercise_name')
->searchable()
->preload()
->createOptionForm([
Forms\Components\TextInput::make('exercise_name'),
])
->createOptionUsing(function ($data){
$exercise = WorkoutExercise::create($data);
return $exercise->getKey();
})
->options(WorkoutExercise::pluck('exercise_name', 'id'))
)
->form(fn (AttachAction $action): array => [
$action->getRecordSelect(),
Forms\Components\TextInput::make('repetitions')->required(),
Forms\Components\TextInput::make('sets')->required(),
Forms\Components\TimePicker::make('rest')
->native(false)
->secondsStep(10)
->displayFormat('i:s')
->format('H:i:s')
->required(),
])
])
where have i messed up?
Solution:
Figured it out. This: ``` ->recordSelect(fn () => Select::make('exercise_name')...
Jump to solution
1 Reply
Solution
torriv
torriv10mo ago
Figured it out. This:
->recordSelect(fn () => Select::make('exercise_name')
->recordSelect(fn () => Select::make('exercise_name')
has to be this:
->recordSelect(fn () => Select::make('recordId')
->recordSelect(fn () => Select::make('recordId')