Switch branches/tags
Nothing to show
Find file
a78c227 Jan 6, 2012
176 lines (116 sloc) 5.05 KB
This library implements a simple z3c.form-based wizard. The wizard is composed
of multiple steps. Each step is a form. Data is stored in a session until
the user clicks the Finish button on the last step.
In order to make good use of this library you'll need to be reasonably familiar
with z3c.form first. Here are some places to start:
* Official documentation:
* Slides from Stephan Richter's tutorial at Plone Conference 2008:\*checkout\*/
Wizard Step
A wizard step is a normal z3c.form form with a few additional features.
By default, the content accessed by this form will be a dictionary
within the wizard's session, with a key equal to the step's prefix.
Additional attributes:
The wizard this step is being used in.
Boolean indicating whether the current step can be accessed via the
wizard navigation links. By default, only steps for which there is already
data stored in the session can be accessed. (The next and previous steps
can always be accessed via the respective buttons regardless of the value
of this property.)
Boolean indicating whether the user should be allowed to move on to the
next step. Defaults to True. If False, the Continue button will be
String. A user-supplied CSS id for the form tag.
Additional methods:
Saves changes from this step to its content (typically a PersistentDict
in the wizard's session.)
Loads the session data for this step based on a context.
Updates a context based on the session data for this step.
Wizard Group Step
Same as a Wizard Step; it just handles a list of groups just like a z3c.form
Additional attributes:
The list of groups you'd like to show up in the form as separate fieldsets
The wizard is also a form, with a list of steps and built-in logic for
moving between those steps.
Class attributes. Override these to affect how the wizard behaves:
A sequence of step classes that will be instantiated when the wizard's
update method is called.
Returns the unique session key used by this wizard instance. By default,
this is a tuple of 'collective.z3cform.wizard' and the URL
path to the wizard.
Attributes set during the update method:
A sequence of wizard step instances.
The wizard step instance currently being displayed.
The (0-based) index of the current step within the activeSteps sequence.
The session where data for this wizard is persisted.
Boolean. True if the first step of the wizard is being displayed.
Boolean. True if the last step of the wizard is being displayed.
Boolean. True if the 'available' attribute of each wizard step is True.
Boolean. True if the wizard has been completed.
The URL of the wizard.
Boolean. True if you want the Wizard to validate the input if a user
uses the Back button on a Step. False if you don't and abandon
all user input (data). Default behavior is True. [Spanky]
Called the first time a wizard is viewed in a given session.
This method may be used to populate the session with data from some
The default implementation calls the loadSteps method.
Loads the wizard session data from a context.
The default implementation calls the 'load' method of each wizard step.
Called when a wizard is successfully completed, after validation of the
final step.
Use this method to carry out some actions based on the values that have
been filled out during completion of the wizard.
The default implementation calls the applySteps method.
Updates a context based on the wizard session data.
The default implementation calls the 'apply' method of each wizard step.
Mark the session as having changed, to ensure that changes get
persisted. This is required since we aren't using a
persistence-aware dictionary class for our session variables.
This package has been tested in Zope 2.10 with Plone 3.3, and in Zope 2.12 with
Plone 4.
It should be pretty easy to get it to work in other environments supported by
z3c.form, such as Zope 3, but I'll need someone familiar with those environments
to tell me how sessions work there, for example.
This package is inspired by and based on the non-session-based z3c.form wizard
included in the collective.singing package, which was implemented by Daniel
Session support, miscellaneous improvements, and repackaging by David Glick.
Thanks also to Nathan van Gheem, Laurence Rowe, and Tom "Spanky" Kapanka.