Select gives required error when i did select elements

So I have the following form element:
Select::make('ligands')
->label('Ligands')
->options(Ligand::all()->pluck('name', 'id'))
->multiple()
->required()
->preload()
->searchable(),
Select::make('ligands')
->label('Ligands')
->options(Ligand::all()->pluck('name', 'id'))
->multiple()
->required()
->preload()
->searchable(),
But when I try to submit it/go to the next step in the wizard it fails the required rule? Even though i have something selected
3 Replies
DanielvdSpoel
DanielvdSpoelOP2y ago
Step code:
Wizard\Step::make('Task settings')
->schema(function (\Closure $get) {
if (!$get('type')) {
return [];
}
$task = $get('type');
$class = new $task();
return $class->settings();
}),
Wizard\Step::make('Task settings')
->schema(function (\Closure $get) {
if (!$get('type')) {
return [];
}
$task = $get('type');
$class = new $task();
return $class->settings();
}),
settings returns a array that contains that form element I do have these console errors: vewire Entangle Error: Livewire property 'mountedTableActionData.testing' cannot be found (
Dan Harrin
Dan Harrin2y ago
if you have dynamic schemas then you need to make sure the form is initialised properly to do that, use afterStateUpdated() on the type field to $set the value of the multiselect to be an empty array that will ensure it is initialised
DanielvdSpoel
DanielvdSpoelOP2y ago
Thanks! That works!
Want results from more Discord servers?
Add your server