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) it works though
No description
Solution:
thank you for the hint! solved by doing this:...
No description
Jump to solution
4 Replies
LeandroFerreira
LeandroFerreira3mo ago
console errors?
LeandroFerreira
LeandroFerreira3mo ago
multiple alpine instances
Solution
Stormageddon, Dark Lord of All
thank you for the hint! solved by doing this:
No description
Want results from more Discord servers?
Add your server