Select not "registering" choice, error saying it's required
Hi! I have made a livewire component that's returning a filament form! It's a Select that gets data from the database and fills it as its options.
When I select an option and press submit, it insists that I must choose an option (even though I has chosen one).
Here is its code.
Solution:Jump to solution
Switching the component from a Select to a CheckboxList seems to have fixed the problem
9 Replies
Can you show that validation error?
The {field name} is required
Is this maybe because of your
ddd()
call?Hmm the code is correct. I'd double-check to make sure the options query is correct (check if the underlying
<select>
has correct value
attributes), remove the afterStateUpdate
stuff and see what reaches the action()
call.
Also, check the value that actually hits the validator I guess. But yeah, the code is correct - I tried the exact same setup and it works
The ddd is there for debug purposes it didn't work even before adding it
Hmm okay I'll give it a try and update you tomorrow
I tried this and I'm getting the same error as before, If I remove the required and try to proceed it just dumps the "schedule" as null
Solution
Switching the component from a Select to a CheckboxList seems to have fixed the problem
It's not the ideal solution for me, as it makes no sense as to why Select does not work
Ok this might be stupid but check if there are any other properties in your component that are affecting it. eg if you have a property called
$messages
, it might affect the validation messages. Anyway, good luckthe issue is with the date validation