F
Filament9mo 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
LeandroFerreira9mo ago
Are you using the panel builder or only the form builder?
toeknee
toeknee9mo ago
Are you editing or creating? Default doesn't work for editing and only on creation.
Mexata
MexataOP9mo ago
creating A form inside a wizard
LeandroFerreira
LeandroFerreira9mo ago
Is it a custom livewire component?
toeknee
toeknee9mo 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
MexataOP9mo ago
no this sadly did not fix the issue
LeandroFerreira
LeandroFerreira9mo ago
Did you try it without disabled() ?
Mexata
MexataOP9mo ago
yes i have, this does not fix it either
LeandroFerreira
LeandroFerreira9mo ago
Please share the whole code you are trying
Mexata
MexataOP9mo ago
toeknee
toeknee9mo 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
MexataOP9mo ago
yes it is
toeknee
toeknee9mo ago
So raise it with Ralph in #ralphjsmit-onboarding-manager-pro
Mexata
MexataOP9mo ago
alright will do

Did you find this page helpful?