© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•11mo ago•
8 replies
aldec

Default values not applied in dynamically created form

I have the method below to dynamically build a form based on a JSON structure in a spatie settings row. The idea is create this form, fill it with the predefined default values from the DB and if I change something it changes it in the DB. This worked flawlessly with a flat array of key-value pairs. Now I needed to nest it and make it one layer deeper and it does not work anymore. When I ddd my fields or sections, I can see the default values but in the rendered form in the browser they are not there. This is the method to generate the form:

I am assuming it does not work because of using $typeKey and $safeKey and same matching does not work? I don't know really... I needed to create the $safeKey because Livewire would not render the page itself with using only $typeKey, I think because of some escaping issues.

Code is in the first answer (character limit)
Solution
I used afterStateHydrated now to fill the config values into the fields. instead of default(). Seems to work for now.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

FileUpload: Default values for edit Form
FilamentFFilament / ❓┊help
10mo ago
default value on dynamically added form fields
FilamentFFilament / ❓┊help
17mo ago
CreateAction with mountUsing() to set specific Field - Default Values are not applied (?!)
FilamentFFilament / ❓┊help
2y ago
How dynamically populate default form data when modal loads?
FilamentFFilament / ❓┊help
3y ago