Wizard - prev button

Good day!

Have anybody had some experiance with main wizard buttons? I’m about “Cancel”, “Prev”, “Next”, “Finish”

I need to implement a validation logic which depends on buttons “Prev” and “Next”. I need something like this: if I click “Next” button validation must work but if I click “Prev” button I don’t need validation.
Could you give me some tips how can I get in preClose method (or somethere else) a fact that “Prev” button was clicked?

Thank you in advance.

hi,

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: GitHub - mariodavid/cuba-component-wizard at cuba-7-based-api - but it has a couple of unresolved issues in there I guess…

Cheers
Mario