I have a working Form Wizard. To get to the wizard the user will click a button from the home page.
If I finish the wizard (three steps) and go back to the home page and click the button again, there's no problem. The wizard is good as new again and all the forms are empty which is what we want.
However if you didn't finish the wizard, like say I'm on the second step and I went back to the home page, click the button there, I'll be back to the second page. That's not what we want. We want a brand new wizard.
I want to implement a "cancel" or "reset" button that if clicked, the user will be redirected to the home page and when the user clicks the button they will be go to the first step of the wizard with all forms empty.
I got it. Apparently I only have to add a reset query param to the url that points to the wizard.
So my <a href="{% url 'go_to_wizard' %}">
becomes <a href="{% url 'go_to_wizard' %}?reset">
and the session will reset and I will go to step 1 of the wizard. Found it after looking at the source code (Hint: line 647).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With