© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•17mo ago•
7 replies
1benjam1

validate() vs getState()

Hi guys ! I'm using a custom Form inside a Livewire component and I need to understand the difference between
validate()
validate()
and
getState()
getState()
. Here is my code :

public function create(): void
{
    $data = $this->form->validate(); // I get validated data, without hidden fields such as `has_blabla`
    $dataBis = $this->form->getState(); // I get validated data, with hidden fields such as `has_blabla`, is it normal ?
}
public function create(): void
{
    $data = $this->form->validate(); // I get validated data, without hidden fields such as `has_blabla`
    $dataBis = $this->form->getState(); // I get validated data, with hidden fields such as `has_blabla`, is it normal ?
}


I'm reusing form fields across multiple forms and some fields needs to be hidden (for the user + in the data), like this one :

Components\TextInput::make('has_blabla')
    ->label('blabla')
    ->required()
    ->visible(fn (): bool => $this->formType === FormTypeEnum::WITNESS),
Components\TextInput::make('has_blabla')
    ->label('blabla')
    ->required()
    ->visible(fn (): bool => $this->formType === FormTypeEnum::WITNESS),
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

getState without Validation
FilamentFFilament / ❓┊help
3y ago
$this->form->getState() empty
FilamentFFilament / ❓┊help
12mo ago
$livewire->getState() Not Working
FilamentFFilament / ❓┊help
3y ago
Multiselect from->getState() empty values
FilamentFFilament / ❓┊help
3y ago