Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go to specific step in form wizard

Is it possible to add a button on a FormWizard form which can direct the user to a specific step in the wizard?

I can obviously get them to go back or start again but I'd like to be able to offer the chance to go to a specific step and change their entries.

like image 599
bodger Avatar asked Jan 06 '16 17:01

bodger


People also ask

What is form wizard with example?

The Form Wizard gives you more control over your results than one-click forms do. The wizard lets you make decisions about certain aspects of a form's design and produces a form based on your instructions.

What is the function of a wizard in Microsoft Access?

There are five object wizards in Access — for tables, queries, forms, reports, and pages. In addition, there is a wizard for creating whole databases. All the wizards, especially the Database Template Wizard, are useful for the Access student because you can get to see how Microsoft did it.


1 Answers

Yes, it's possible. Simplest way is to use NamedUrlWizardView

If you use simple WizardView, you have to send wizard_goto_step parameter with a value equal to step name.

Let's say you have WizardView with steps like next

class OrderWizardView(SessionWizardView):
    form_list = (
        ('select_customer', forms.WizardCustomerForm),
        ('products', forms.WizardProductFormset),
        ('order', forms.WizardOrderForm),
        ('customer', forms.WizardCustomerDetailsForm),
        ('review', forms.WizardReviewForm),
    )

For Previous/First step you can use {{ wizard.steps.prev }} and {{ wizard.steps.first }} template variables.

<button name="wizard_goto_step" value="{{ wizard.steps.first }}">First Step</button>
<button name="wizard_goto_step" value="{{ wizard.steps.prev }}">Prev Step</button>

If you need a specific step - use its name!

<button name="wizard_goto_step" value="select_customer">Select customer</button>
<button name="wizard_goto_step" value="products">Add products</button>
...
<button name="wizard_goto_step" value="review">Review</button>
like image 93
Vadym Avatar answered Sep 28 '22 10:09

Vadym