F
Filament2mo ago
Calden

validation.in on form submit

Hey ! I don’t understand why I’m getting this message 'validation.in' when I try to submit the form, and as a result the form doesn’t submit !
Select::make('matieres')
->label('Matière(s)')
->multiple()
->relationship('matieres', 'nom')
->options(Matiere::whereHas('sessions', function ($Query) {
$Query->where('session_id', '=', Filament::getTenant()->id);
})->get()->sortBy(function ($matiere) {
return $matiere->nom; // Sort by the accessor value
})
->mapWithKeys(function ($matiere) {
return [$matiere->id => $matiere->nom]; // Uses the getNomAttribute() accessor
}))
->preload()
->live()
-required()
Select::make('matieres')
->label('Matière(s)')
->multiple()
->relationship('matieres', 'nom')
->options(Matiere::whereHas('sessions', function ($Query) {
$Query->where('session_id', '=', Filament::getTenant()->id);
})->get()->sortBy(function ($matiere) {
return $matiere->nom; // Sort by the accessor value
})
->mapWithKeys(function ($matiere) {
return [$matiere->id => $matiere->nom]; // Uses the getNomAttribute() accessor
}))
->preload()
->live()
-required()
Its in my "Cours" resource with the "Cours" model with the relation :
public function matieres(): BelongsToMany
{
return $this->belongsToMany(Matiere::class);
}
public function matieres(): BelongsToMany
{
return $this->belongsToMany(Matiere::class);
}
It worked in v3, but in v4 I’m getting this message now.
No description
1 Reply
Dan Harrin
Dan Harrin2mo ago
Check your validation.php lang file, is the key for your language missing? the error suggests that the value that is selected is not present as a key in the options array

Did you find this page helpful?