Advanced - Form Builder
Could you please help me understand why selecting a company name in my app results in a blank page when I use the reactive() and afterStateUpdated() methods? Your insights would be greatly appreciated. There is no error in my browser console.
I noticed that this occurred after upgrading to Filament v3 on a different branch.
11 Replies
I think this might be the issue:
$company = \App\Models\Company::find($get('company_id'));
I'm not sure you can use $get
in that context
Do you have any logging errors you could share?No, I didn't get any log error
Need help!
Is this in a Resource or a Livewire class/form?
Livewire form
Yeah I’ve had that happen specifically only in a Livewire form. If it is an edit page, try and make sure you are filling in all the attributes in mount like “$this->form->fill([‘post’ => … ])”. Sorry for bad formatting I’m on my phone.
Oh also remove the searchable on the Select, that has caused it for me before…
It's not working
->options(function (callable $get) {
$company = \App\Models\Company::find($get('company_id'));
if (! $company) {
return \App\Models\Location::all()->pluck('name', 'id');
}
return $company->locations->pluck('name', 'id');
})
->string()
Why have to passed ->string() into select list which is an array?
Then provide a full page code snippet so we can see what you are doing and if you have mount etc.
Why have to passed ->string() into select list which is an array?I forgot to remove it. @toeknee_iom here https://gist.github.com/ShaungBhone/6962b73ef09efc4d4de7c4401c8341a7
Looks generally good. Check your browser console
There is no error in my console as I mentioned.
This code is reference from Dan. https://www.youtube.com/watch?v=W_eNyimRi3w&t=2s
It had worked before I updated to v3.