Select input value not being set
class LogTrips extends Component implements HasForms
{
use InteractsWithForms;
public ?array $data = [];
public function mount(): void
{
$this->form->fill();
}
public function form(Form $form): Form
{
return $form
->schema([
Select::make('from_id')
->native(false)
->options(fn () => Station::get()->pluck('name', 'id')),
Select::make('to_id')
->options(fn () => Station::get()->pluck('name', 'id'))
->native(false),
TextInput::make('fare')
->suffix('TND')
->required()
->columnSpanFull()
->minValue(0.900)
->maxValue(80)
->numeric(),
])->columns(2)
->statePath('data');
}
public function create(): void
{
dd($this->form->getState());
}
public function render(): View
{
return view('livewire.log-trips');
}
}class LogTrips extends Component implements HasForms
{
use InteractsWithForms;
public ?array $data = [];
public function mount(): void
{
$this->form->fill();
}
public function form(Form $form): Form
{
return $form
->schema([
Select::make('from_id')
->native(false)
->options(fn () => Station::get()->pluck('name', 'id')),
Select::make('to_id')
->options(fn () => Station::get()->pluck('name', 'id'))
->native(false),
TextInput::make('fare')
->suffix('TND')
->required()
->columnSpanFull()
->minValue(0.900)
->maxValue(80)
->numeric(),
])->columns(2)
->statePath('data');
}
public function create(): void
{
dd($this->form->getState());
}
public function render(): View
{
return view('livewire.log-trips');
}
}from_id and to_id are not being set.
if I use
->native(true)->native(true) it works though
