I think there is this hook method in the steps
preClose : https://github.com/mariodavid/cuba-component-wizard/blob/master/modules/gui/src/de/diedavids/cuba/wizard/gui/components/AbstractWizardStep.java#L11 which gives you an entry point. But I think it misses the context which button was clicked.
I can think of some hacky ways on how to implement it, but I’m not really sure how to do it.
I’m currently playing around with a new Wizard API that fully supports CUBA 7 UI APIs and this will contain such a functionality. It has a event
WizardStepPreChangeEvent, which contains the previous step and the destination step. This way you could determine if someone was actually trying to go back. Here is an example: https://github.com/mariodavid/cuba-component-wizard/blob/cuba-7-based-api/modules/web/src/de/diedavids/cuba/wizard/web/screens/sample/cuba7/WizardTestScreen.java#L37
Perhaps it would be even better to support this use case more explicit via a dedicated Event. One for “nextStep” and another one for “previousStep”.
I will think about it. But it can take a while until this CUBA 7 based API is ready. Probably it will also not be backwards compatible, so it would require you to change your code to adopt to the new version.
If you want to take a look, it is this branch: https://github.com/mariodavid/cuba-component-wizard/tree/cuba-7-based-api - but it has a couple of unresolved issues in there I guess…