FillForms not working on a custom page with multiple forms.

I got a custom page where i use multiple forms. in the mount function i add a fillforms method.
public function mount(): void
{
if (!isAssetManager() && !isManager()) {
abort(404);
}

//Get the user
$this->user = Filament::auth()->user();

$this->profileData = [
// 'id' => $user->id,
'Naam' => $this->user->name,
'Email' => $this->user->email,
'Telefoonnummer' => $this->user->phone_number,

// Add other properties as needed
];

$this->fillForms();
public function mount(): void
{
if (!isAssetManager() && !isManager()) {
abort(404);
}

//Get the user
$this->user = Filament::auth()->user();

$this->profileData = [
// 'id' => $user->id,
'Naam' => $this->user->name,
'Email' => $this->user->email,
'Telefoonnummer' => $this->user->phone_number,

// Add other properties as needed
];

$this->fillForms();
Then i try to fill it but the toggle always stays false i dont know what im missing
protected function fillForms(): void
{
$this->getAccountFormSchema->fill();
$this->getDashboardFormSchema->fill();
$this->getConnectivityFormSchema->fill(['mileage_request_service' => true]);
}

protected function getForms(): array
{
return [
'getAccountFormSchema',
'getDashboardFormSchema',
'getConnectivityFormSchema',
];
}
protected function getConnectivityFormSchema(Form $form): Form
{
return $form
->schema([
Toggle::make('mileage_request_service')
->label('Kilometerstand ophalen doormiddel van online service')
->reactive(),
]);
}
protected function fillForms(): void
{
$this->getAccountFormSchema->fill();
$this->getDashboardFormSchema->fill();
$this->getConnectivityFormSchema->fill(['mileage_request_service' => true]);
}

protected function getForms(): array
{
return [
'getAccountFormSchema',
'getDashboardFormSchema',
'getConnectivityFormSchema',
];
}
protected function getConnectivityFormSchema(Form $form): Form
{
return $form
->schema([
Toggle::make('mileage_request_service')
->label('Kilometerstand ophalen doormiddel van online service')
->reactive(),
]);
}
Solution:
Fixed the problem
Jump to solution
1 Reply
Solution
Zakhaev
Zakhaev7mo ago
Fixed the problem
Want results from more Discord servers?
Add your server