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
LeandroFerreira5mo ago
console errors?
King Dice
King DiceOP5mo ago
No description
LeandroFerreira
LeandroFerreira5mo ago
multiple alpine instances
Solution
King Dice
King Dice5mo ago
thank you for the hint! solved by doing this:
No description
Want results from more Discord servers?
Add your server