Select with Multiple and Required Not Working with Dynamically Generated Schema
Hello - has anyone had any difficulty using select, multiple, and required in the same element? For example:
I have only had an issue when I am dynamically generating the schema. When I submit the form, I get an error saying I must make a selection even though I already have (screenshot attached). Strangely, this error does not occur when the user is only allowed to select one option (i.e.:
->multiple(false)
).10 Replies
It was supposed to work..
is the
$category->id
unique?Yes it is unique
I have used this type of select component in the past without issue. The only real difference I can think of is that this schema is dynamically generated
Could that be the cause?
can you share the project on github?
The entire project?
or a fresh install with this resource
It's actually a custom form in a relation manager that is triggered from
protected function getTableHeaderActions()
So after some more trial and error, I've realized that it isn't specifically related to the ->multiple()
option
I dynamically create these attributes, and I get the following console error when they appearWhen I get this error, all of these fields end up as
NULL
after I submit the formI believe my issue is related to a broader Filament issue: https://github.com/filamentphp/filament/discussions/4350
GitHub
Dynamic reactive fields · filamentphp filament · Discussion #4350
Hi, I'm wondering if it's currently possible to produce dynamic forms with different fields depending on what was selected earlier in the form. We sort of have this working, but it uses Com...
related to dynamically created form fields
In case this helps anyone else in the future, I had to work around this by generating the form fields on the initial page load and then using
visible()
to show/hide them