Call Resource Save Changes Button
Hello,
How could I call the Save Changes button action from another action button ? Thanks π
4 Replies
Nevermind π
Did you fix it?
Yes, just
$this->save()
use Filament\Forms;
public function form(Form $form): Form
{
return $form
->schema([
// Your form fields here
Forms\Components\TextInput::make('name')->required(),
// Save button
Forms\Components\Button::make('save')
->label('Save Changes')
->action('saveAction'),
// Another button to trigger save
Forms\Components\Button::make('triggerSave')
->label('Trigger Save')
->reactive()
->action(function () {
$this->saveAction();
}),
]);
}
public function saveAction()
{
// Your save logic here
}