My Select isn't getting a value on form submit from Livewire Component

My Select:
public function form(Form $form): Form
{
return $form->schema([
Select::make('quickbooks_vendor_ref_id')
->label('Quickbooks Vendor')
->options(LocationVendors::get(SelectedLocation::get())->pluck('display_name', 'quickbooks_vendor_ref_id')->toArray())
->live()
->searchable()
->loadingMessage('Loading vendors...')
->suffixAction(
Action::make('refreshVendors')
->label('Refresh Vendors')
->icon('heroicon-o-arrow-path')
->action(fn () => LocationVendors::get(SelectedLocation::get(), true)->pluck('display_name', 'quickbooks_vendor_ref_id')->toArray())
),
...
}
public function form(Form $form): Form
{
return $form->schema([
Select::make('quickbooks_vendor_ref_id')
->label('Quickbooks Vendor')
->options(LocationVendors::get(SelectedLocation::get())->pluck('display_name', 'quickbooks_vendor_ref_id')->toArray())
->live()
->searchable()
->loadingMessage('Loading vendors...')
->suffixAction(
Action::make('refreshVendors')
->label('Refresh Vendors')
->icon('heroicon-o-arrow-path')
->action(fn () => LocationVendors::get(SelectedLocation::get(), true)->pluck('display_name', 'quickbooks_vendor_ref_id')->toArray())
),
...
}
and this produces the attached screen shot:;
public function save(): void
{

$data = $this->form->getState();

dd($data);
}
public function save(): void
{

$data = $this->form->getState();

dd($data);
}
No matter what I do, it's always null.
No description
Solution:
yeah the value is selected..
Jump to solution
3 Replies
josef
josef13mo ago
I assume you select a value?
Solution
Jon Mason
Jon Mason13mo ago
yeah the value is selected..
Jon Mason
Jon MasonOP13mo ago
I figured this out. It's actually a bug I've run into before. It won't work with the ->searchable() method for some reason. I commented that out and now it works fine.
Want results from more Discord servers?
Add your server