Disabled select field with default not taken into account when creating record
Hi! π
I've just upgraded to Filament v3 and the experience is amazing so far! π
Only one little hiccup: one of my select fields doesn't work anymore (probably because I didn't really searched for how it works under the hood...)
Here is my field definition:
It allows the user to see which team the record is going to be created under.
Saving the record into the database fails because the insertion isn't provided with the
team_id
. It worked on v2 for some reason.
Is there an "idiomatic" way to make it work? I can just force it into the insertion query of course but wanted to know if there was a "better" way. Also, if it's disabled, could the user forge a request modifying it or it's fine without a check on my end?
Note: this field is in a wizard and it doesn't work without the ->relationship
either.3 Replies
Workaround for the moment in the
Create
page:
I think this is normal... in a regular HTML form, disabled fields are not included in the request.
Your solution is pretty good, because the data is sensitive and shouldn't be modified by a clever user with the browser dev tools.
I would've hoped Filament would inject those but eh, fair enough.
I wonder why it worked with Filament 2 though!