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
dissto3mo ago
You need to show some code, otherwise its just guessing 🤓
KingNii
KingNiiOP3mo 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
awcodes3mo ago
Put the options in a callback, so, ->options( fn () => School::all()->etc That will force it to be re-evaluated
KingNii
KingNiiOP3mo 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
awcodes3mo ago
Is this a relationship?
KingNii
KingNiiOP3mo ago
@awcodes no please A student registration form where we selecct the student's school
awcodes
awcodes3mo 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
KingNiiOP3mo ago
@awcodes What do you have in mind?
awcodes
awcodes3mo 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
KingNiiOP3mo ago
But everything works perfectly without the searchable and works nicely in the admin panel with the same select @awcodes
awcodes
awcodes3mo 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
KingNiiOP3mo ago
@awcodes I get it Thank you
wagnerfnds
wagnerfnds3mo 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
KingNiiOP3mo ago
Have you found any fix?
Zen Nitiruj
Zen Nitiruj3mo ago
Have you update to Filament 3.2.119? it will fix.
KingNii
KingNiiOP2mo ago
I’ll try it @Zen Dev I'm still getting the same issue
Want results from more Discord servers?
Add your server