Custom Page with Form Builder

Hello Guys, I'm testing the Custom Page and i have a problem with the Repeater Component. It's simply don't start the component. The warning in browser console is printed. This is my blade content:
<x-filament-panels::page>
{{ $this->form }}
</x-filament-panels::page>
<x-filament-panels::page>
{{ $this->form }}
</x-filament-panels::page>
This is my page class:
<?php

namespace App\Filament\Pages;

use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Filament\Pages\Page;

class Settings extends Page implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;

protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.settings';

public function form(Form $form): Form
{
return $form
->schema([
Repeater::make('items')
->schema([
TextInput::make('title')->required(),
])
->addActionLabel('Add member')
->defaultItems(3)
]);
}

}
<?php

namespace App\Filament\Pages;

use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Filament\Pages\Page;

class Settings extends Page implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;

protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.settings';

public function form(Form $form): Form
{
return $form
->schema([
Repeater::make('items')
->schema([
TextInput::make('title')->required(),
])
->addActionLabel('Add member')
->defaultItems(3)
]);
}

}
10 Replies
awcodes
awcodes16mo ago
You’re on the right track but you’re not doing everything needed to set it up. You need to call $this->form->fill() in the mount function. You’ll also need to create a public property for the form data and set that to the statePath for the form.
adriejsilva
adriejsilvaOP16mo ago
Oh man, it's work nowww!!! Thank you Why this different are in diff pages? I had already seen, buty is two commands differents to create a Page
adriejsilva
adriejsilvaOP16mo ago
In that case, in panel builder, its my case, don't have all process. Have a motive?
awcodes
awcodes16mo ago
Sorry, not sure what you’re asking.
adriejsilva
adriejsilvaOP16mo ago
Sorry, my english is a little bad.
awcodes
awcodes16mo ago
There is no difference. You’re just assuming that the two are different. When you create a custom page it’s basically just a shell that is a livewire component. So the process in the second link is the application of your functionality to the livewire component. It’s fair that there’s some confusion there, but understanding livewire should help with the mental model of how it works. It has to be described this way in the docs because you can use the forms, or any of the other packages without the panels.
adriejsilva
adriejsilvaOP16mo ago
You are right, I'll take some time to read more about liveware. Thank you for your help
Want results from more Discord servers?
Add your server