© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
12 replies
Patrick

get a field value in an action

How can i get the value of a form field inside an action?

This is my action:

Actions\Action::make('gespreksverslag_herschrijven')
->label('Gespreksverslag herschrijven')
->icon('heroicon-o-pencil')
->action(function(Get $get){

$originalText = $get('conversation_report_original');

$service = new RewriteTextWithGPTService();
$rewrittenText = $service->handle(static::$prompt, $originalText);

$this->form->fill(['conversation_report_gpt' => $rewrittenText]);
}),


$get() will give m the following error: Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization

It must be simple, but I can't find it in the docs. What am i missing?
Solution
Found it. I can use $this->data to retrieve the form values

Actions\Action::make('gespreksverslag_herschrijven')
->label('Gespreksverslag herschrijven')
->icon('heroicon-o-pencil')
->action(function(){
$originalText = $this->data['conversation_report_original'];
$service = new RewriteTextWithGPTService();
$rewrittenText = $service->handle(static::$prompt, $originalText);

$this->form->fill(['conversation_report_gpt' => $rewrittenText]);
}),
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Get value of field within an action
FilamentFFilament / ❓┊help
3y ago
Setting a field value from an action
FilamentFFilament / ❓┊help
2y ago
Get input value in suffix action
FilamentFFilament / ❓┊help
5mo ago
Action refresh Select field value
FilamentFFilament / ❓┊help
3y ago