F
FilamentTetracyclic

Select::selectablePlaceholder(false) not working with relationships

I have the following select component, which correctly displays as a list of the user's leads, with the first item always selected:
Components\Select::make('lead_id')
->relationship('lead', 'name', fn (): Builder => Lead::query()->where('user_id', auth()->user()->id))
->selectablePlaceholder(false)
->required()
Components\Select::make('lead_id')
->relationship('lead', 'name', fn (): Builder => Lead::query()->where('user_id', auth()->user()->id))
->selectablePlaceholder(false)
->required()
If selectablePlaceholder(false) is removed, it works as expected. With it in place however, it always fails the required() validation, despite the option being selected. Removing required() allows the form to be saved, but the lead_id value is never persisted to the database.
S
Shavik6d ago
I'm experiencing this as well. Did you ever figure it out? Looks like if I set the default option 'it works' but I expected having no selectable placeholder meant that the 'option shown' would be the one submitted.
A
awcodes6d ago
Pretty sure if there is no interaction with the select then no value is ever set, so the state in lw/alpine will always be null.
Want results from more Discord servers?
Add your server
More Posts