F
Filament2mo ago
Mexata

->default function inside a wizard form

Could anyone tell me why ->default() is not working at all.
Group::make([
TextInput::make('identity')
->label('Identity')
->required()
TextInput::make('web')
->label('Web Url')
->default('https://www.test.com/v1/{identity}')
->disabled()
->required(),
])
Group::make([
TextInput::make('identity')
->label('Identity')
->required()
TextInput::make('web')
->label('Web Url')
->default('https://www.test.com/v1/{identity}')
->disabled()
->required(),
])
14 Replies
LeandroFerreira
LeandroFerreira2mo ago
Are you using the panel builder or only the form builder?
toeknee
toeknee2mo ago
Are you editing or creating? Default doesn't work for editing and only on creation.
Mexata
Mexata2mo ago
creating A form inside a wizard
LeandroFerreira
LeandroFerreira2mo ago
Is it a custom livewire component?
toeknee
toeknee2mo ago
Ensure your mount is set to form fill. But I don't think you are doing it correctly, I think you actually want:
Group::make([
TextInput::make('identity')
->label('Identity')
->live()
->afterStateUpdated(fn($state, $set) => $set('web', 'https://www.test.com/v1/' . $state))
->required()
TextInput::make('web')
->label('Web Url')
->default('https://www.test.com/v1/{identity}')
->disabled()
->required(),
])
Group::make([
TextInput::make('identity')
->label('Identity')
->live()
->afterStateUpdated(fn($state, $set) => $set('web', 'https://www.test.com/v1/' . $state))
->required()
TextInput::make('web')
->label('Web Url')
->default('https://www.test.com/v1/{identity}')
->disabled()
->required(),
])
Mexata
Mexata2mo ago
no this sadly did not fix the issue
LeandroFerreira
LeandroFerreira2mo ago
Did you try it without disabled() ?
Mexata
Mexata2mo ago
yes i have, this does not fix it either
LeandroFerreira
LeandroFerreira2mo ago
Please share the whole code you are trying
toeknee
toeknee2mo ago
So that's not a filament wizard/form natively, it's through a plugin, natively it works. I also suspect it's not actually mounting... is this filament onboard pro?
Mexata
Mexata2mo ago
yes it is
toeknee
toeknee2mo ago
So raise it with Ralph in #ralphjsmit-onboarding-manager-pro
Mexata
Mexata2mo ago
alright will do