F
Filament5mo ago
Reda

Hide "save changes" button in form wizard

I have made an auto save form. But i don't know how to hide the "save changes" button, because it is not necessary in my case
No description
Solution:
I think instead of using HasWizard trait, you could use the Wizard field in the pages or resource: ```php public function form(Form $form): Form {...
Jump to solution
10 Replies
Asmit Nepali
Asmit Nepali5mo ago
@redaoutarid You can use
getSaveFormAction
getSaveFormAction
method on edit page.
protected function getSaveFormAction(): Action
{
return parent::getSaveFormAction()->hidden(); // TODO: Change the autogenerated stub
}
protected function getSaveFormAction(): Action
{
return parent::getSaveFormAction()->hidden(); // TODO: Change the autogenerated stub
}
Reda
RedaOP5mo ago
@Asmit Nepali it doesn't work. It is only disabled not hidden
No description
Reda
RedaOP5mo ago
i also tried this code, and i get the same result
No description
LeandroFerreira
LeandroFerreira5mo ago
Are you using the wizard in a resource?
Reda
RedaOP5mo ago
@Leandro Ferreira i use them in pages
No description
Asmit Nepali
Asmit Nepali5mo ago
@redaoutarid Could you please try using
getSaveFormAction
getSaveFormAction
on a standard edit form? I'm interested in knowing what happens when it's applied to a regular form, rather than a form wizard. Because I tried on regular form.
Solution
LeandroFerreira
LeandroFerreira5mo ago
I think instead of using HasWizard trait, you could use the Wizard field in the pages or resource:
public function form(Form $form): Form
{
return $form->schema([
Wizard::make([
Step::make('step1')
->schema([
...
]),
Step::make('step2')
->schema([
...
]),
]),
]);
}
public function form(Form $form): Form
{
return $form->schema([
Wizard::make([
Step::make('step1')
->schema([
...
]),
Step::make('step2')
->schema([
...
]),
]),
]);
}
Reda
RedaOP5mo ago
it works, thank you. I don't know why it doesn't work when using HasWizard trait can you check @Leandro Ferreira's answer
Asmit Nepali
Asmit Nepali5mo ago
LeandroFerreira
LeandroFerreira5mo ago
because ->submitAction($this->getSubmitFormAction()) in the trait You can also create a custom trait or comment the submit action in the form method
public function form(Form $form): Form
{
return parent::form($form)
->schema([
Wizard::make($this->getSteps())
->startOnStep($this->getStartStep())
->cancelAction($this->getCancelFormAction())
//->submitAction($this->getSubmitFormAction())
->skippable($this->hasSkippableSteps()),
])
->columns(null);
}
public function form(Form $form): Form
{
return parent::form($form)
->schema([
Wizard::make($this->getSteps())
->startOnStep($this->getStartStep())
->cancelAction($this->getCancelFormAction())
//->submitAction($this->getSubmitFormAction())
->skippable($this->hasSkippableSteps()),
])
->columns(null);
}
Want results from more Discord servers?
Add your server