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