© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
3 replies
Daniel Plomp

Get value of field within an action

I have a field which uses a hintAction. This action opens a modal window and I want to prefill the field with the value of the component that triggers the action.
I though of using
fillForm
fillForm
but I don't see how to use e.g. a
$get
$get
within that function. The documenation shows an example with
$this->record
$this->record
but that doesn't work.

This is the code:

->form([
  RichEditor::make('job_description_original')
      ->disableAllToolbarButtons()
      ->label('Origineel')
      ->afterStateHydrated(function ($get) {
          dd($get('job_description')); // returns null?
      })
      ->disabled(),
->form([
  RichEditor::make('job_description_original')
      ->disableAllToolbarButtons()
      ->label('Origineel')
      ->afterStateHydrated(function ($get) {
          dd($get('job_description')); // returns null?
      })
      ->disabled(),


I also tried to use the
default
default
function, which works, but I don't want the default to be the
$record
$record
value, but the actual value inside the component:

->default(fn ($record) => $record->job_description), // works, but only with $record, not with $get
->default(fn ($record) => $record->job_description), // works, but only with $record, not with $get


What is the best practice in this case?
Solution
Maybe this
    ->default(fn ($livewire) => $livewire->data['job_description'])
    ->default(fn ($livewire) => $livewire->data['job_description'])
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

get a field value in an action
FilamentFFilament / ❓┊help
2y ago
Setting a field value from an action
FilamentFFilament / ❓┊help
2y ago
Set value of another field from within default
FilamentFFilament / ❓┊help
3y ago
How can I get the value of an input from the parent schema from within an action?
FilamentFFilament / ❓┊help
6d ago