Select input not working when searchable is appended

The select input I added to my form doesn’t work in the sense that it return “School name is required” even though I have selected a school. I don’t face this issue when I comment out the searchable method
No description
16 Replies
dissto
dissto2w ago
You need to show some code, otherwise its just guessing 🤓
KingNii
KingNii2w ago
Select::make('school_name')
->label('School name')
// ->live()
->options(School::all()->pluck("school_name", "id")->toArray())
// ->searchable(['school_name'])
// ->optionsLimit(20)
// ->preload()
->required(),
Select::make('school_name')
->label('School name')
// ->live()
->options(School::all()->pluck("school_name", "id")->toArray())
// ->searchable(['school_name'])
// ->optionsLimit(20)
// ->preload()
->required(),
@dissto
awcodes
awcodes2w ago
Put the options in a callback, so, ->options( fn () => School::all()->etc That will force it to be re-evaluated
KingNii
KingNii2w ago
@awcodes I'm still facing the same issue
Select::make('school_name')
->label('School name')
// ->live()
->options(fn() => School::all()->pluck("school_name", "id")->toArray())
->searchable(['school_name'])
// ->optionsLimit(20)
// ->preload()
->required(),
Select::make('school_name')
->label('School name')
// ->live()
->options(fn() => School::all()->pluck("school_name", "id")->toArray())
->searchable(['school_name'])
// ->optionsLimit(20)
// ->preload()
->required(),
awcodes
awcodes2w ago
Is this a relationship?
KingNii
KingNii2w ago
@awcodes no please A student registration form where we selecct the student's school
awcodes
awcodes2w ago
Sounds like a relationship to me. In which case the relationship could be off considering the code provided doesn’t use a relationship.
KingNii
KingNii2w ago
@awcodes What do you have in mind?
awcodes
awcodes2w ago
I really don’t know, just making a best guess on the code you’ve shared. But it looks like a relationship to me which means the select needs to be based on the relationship instead of the options modifier.
KingNii
KingNii2w ago
But everything works perfectly without the searchable and works nicely in the admin panel with the same select @awcodes
awcodes
awcodes2w ago
Ok, but those are 2 completely different use cases. Panels have a lot of preconfigured expectations. If you aren’t in a panel context then you have to connect all the pieces.
KingNii
KingNii2w ago
@awcodes I get it Thank you
wagnerfnds
wagnerfnds7d ago
I guess this can be a bug on recent version of the select field, mine was running just fine, but after composer update it stop working, the same error showing on https://discord.com/channels/883083792112300104/1296146287460093982
KingNii
KingNii5d ago
Have you found any fix?
Zen Nitiruj
Zen Nitiruj4d ago
Have you update to Filament 3.2.119? it will fix.
KingNii
KingNii2d ago
I’ll try it
Want results from more Discord servers?
Add your server