F
Filament3mo ago
Harold

How to disable previous action

Ive already seen a question like this, but i don't want to make it visually disabled. But to prevent the user from going back at all. Is this possible?
6 Replies
toeknee
toeknee3mo ago
PRevious back in the page?
Harold
HaroldOP3mo ago
Oh sorry I didnt specify it. In the wizard form
Bruno Pereira
Bruno Pereira3mo ago
you can try this
->afterValidation(function () {
// ...

if (currentStep < nextStep) {
throw new Halt();
}
})
->afterValidation(function () {
// ...

if (currentStep < nextStep) {
throw new Halt();
}
})
Bruno Pereira
Bruno Pereira3mo ago
I guess if your wizard has 3 steps and you're in step 2 and want to go to step 1 the "next step" is the number 1
toeknee
toeknee3mo ago
if you add this to the wizard it will disable back and then hide the button:
->previousAction(fn ($action) => $action->visible(false)->extraAttributes(['style' => 'display:none;']))
->previousAction(fn ($action) => $action->visible(false)->extraAttributes(['style' => 'display:none;']))

Did you find this page helpful?