wiki:development/multistepform

MultiStepForm? Development Plan

Contact

  • Ingo Schommer (ingo at silverstripe dot com)
  • Sean Harvey (sean at silverstripe dot com)

Status

Research

Current Shortcomings

  • Dozens of custom designed solutions for multistep forms
  • Hard to debug/test custom solutions

Requirements

  • Saving form-data to session (default) or associated DataObjects?
  • Deserialization from session into Form
  • Each step is associated with its own form
  • Automated next/prev navigation (prev is turned off by default)
  • Simpled step branching
  • Progress Display (gets tricky with undirected forms)
  • Customizeable "start" and "finalize" actions
  • Optional: Automatically manage relations
  • Optional: Save for later usage

Class: MultiFormController?

  • extends Controller? Object?
  • Usually embedded in another controller (ContentController?, PagelessController?), shouldn't be toplevel
  • has $start_step and $final_steps indicators which trigger start() and finish() on the controller
  • Optional: Allow direct access of steps through REQUEST or URL (within the constraints of getNextStep() of course, can't jump directly to final step)

Class: MultiFormStep?

  • extends Object
  • instanciated and managed by MutliFormController? - persists in the database serialized by MultiFormSession?
  • should be subclassed for each required step, e.g. PersonalInfoStep?, CompanyInfoStep?, FinalConfirmStep?
  • custom onBeforeStart() and onBeforeFinish() hooks
  • serialize() controls which data is saved (data passed down by MultiFormController? on submission)
  • defaults to first step of $nextsteps, but eventually determined by getNextStep()
  • same behaviour with $previoussteps - needs to be implemented with "back navigation" is enabled
  • Optional: allow for rendering with custom Form template (e.g. to stitch form manually, as seen in Merge project)

Class: MultiFormSession?

  • extends Dataobject
  • defaults to session storage (one row per form submission) with a map of serialized data for each formstep
  • information about current formstep
  • Optional: information about the taken route (incl. back/forward navigations)
  • knows wether session was finalized
  • can be addressed through a unique URL (e.g. for email-confirmation of "finish later" scenarios)

Class: MultiFormCleanerTask?

  • extends DailyTask?
  • finds MultiFormSession? objects which are older than X days and not finished and deletes the object
  • finds all associated DataObject? instances for unfinished steps (through serialized data) and deletes them as well

Data/Session? Handling

  • Needs to allow for saving each step into one or more DataObject? instances
  • Optional: Allow developers to "mix'n'match" between Session-only storage (default) and direct saving to DataObject?

Progress Indication

  • only works for simple branching, no complicated node-path computation
  • number of total steps might change on branched progress (once a step is reached)
  • each MutliFormStep? has an (optional) headline/description shown as progress in an unordered list
  • essentially the MutliFormController? returns a StepsTotal?() and StepsCompleted?() obtained by MultiFormSession?
  • Optional: Output as "percentage completed"

Misc

  • Hook this up to the ecommerce payment forms?