F
Filament3mo ago
Daniel

Repeater does not work on customized page

The add button does not work, my code:
Section::make('Receivers')
->schema([
Repeater::make('receiver')
->live()
->schema([
Grid::make(3)
->schema([
TextInput::make('name'),
])
])
])
Section::make('Receivers')
->schema([
Repeater::make('receiver')
->live()
->schema([
Grid::make(3)
->schema([
TextInput::make('name'),
])
])
])
No description
Solution:
make sure you're calling $this->form->fill() in the mount method.
Jump to solution
5 Replies
Solution
awcodes
awcodes3mo ago
make sure you're calling $this->form->fill() in the mount method.
Daniel
Daniel3mo ago
public function mount(): void
{
$this->form->fill([
'receiver' => []
]);
}
public function mount(): void
{
$this->form->fill([
'receiver' => []
]);
}
like this?
awcodes
awcodes3mo ago
You only need to pass the array to it if you are setting specific data for the form state. Otherwise just call it as fill() Fill sets up and initializes the form and actions, etc.
awcodes
awcodes3mo ago
Check out these docs too. They will give you more insight to forms. Just remember that the custom page is the livewire component. https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component
Daniel
Daniel3mo ago
Very thanks
Want results from more Discord servers?
Add your server