© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•9mo ago•
28 replies
alan

Unexpected Dehydration of Hidden Fields with statePath

Why are fields that are
hidden
hidden
and located inside a
Section
Section
with a
statePath
statePath
dehydrated, and how can this be avoided (while still using
statePath
statePath
)? Normally, hidden inputs should be hidden. Or not?

Example:

protected function handleRecordCreation(array $data): Model
{
    Log::info(json_encode($data, JSON_PRETTY_PRINT));
    dd($data);
}

public function form(Form $form): Form
{
    return $form->schema([
        Section::make("Your Information")->schema([
            TextInput::make('name')->label("Your Name (for section)")->default('test')->hidden(),
        ])
        ->columns(2)
        ->statePath('data'),
    ]);
}
protected function handleRecordCreation(array $data): Model
{
    Log::info(json_encode($data, JSON_PRETTY_PRINT));
    dd($data);
}

public function form(Form $form): Form
{
    return $form->schema([
        Section::make("Your Information")->schema([
            TextInput::make('name')->label("Your Name (for section)")->default('test')->hidden(),
        ])
        ->columns(2)
        ->statePath('data'),
    ]);
}


=> log:

array:1 [▼
  "data" => array:1 [
    "name" => "test"
  ] // (not correct)
]
array:1 [▼
  "data" => array:1 [
    "name" => "test"
  ] // (not correct)
]


without state Path:

protected function handleRecordCreation(array $data): Model
{
    Log::info(json_encode($data, JSON_PRETTY_PRINT));
    dd($data);
}

public function form(Form $form): Form
{
    return $form->schema([
        Section::make("Your Information")->schema([
            TextInput::make('name')->label("Your Name (for section)")->default('test')->hidden(),
        ])
        ->columns(2), 
        //->statePath('data'), statePath removed
    ]);
}
protected function handleRecordCreation(array $data): Model
{
    Log::info(json_encode($data, JSON_PRETTY_PRINT));
    dd($data);
}

public function form(Form $form): Form
{
    return $form->schema([
        Section::make("Your Information")->schema([
            TextInput::make('name')->label("Your Name (for section)")->default('test')->hidden(),
        ])
        ->columns(2), 
        //->statePath('data'), statePath removed
    ]);
}


log:

[] // (correct)
[] // (correct)
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

Hidden fields
FilamentFFilament / ❓┊help
3y ago
statePath variable missing some form fields
FilamentFFilament / ❓┊help
14mo ago
Include hidden fields
FilamentFFilament / ❓┊help
12mo ago
Empty hidden fields
FilamentFFilament / ❓┊help
2y ago