Coder Social home page Coder Social logo

yii2-wizard's Introduction

yii2-wizard

Yii2 Extension to handle multi-form wizards.

Features

  • All forms submit to the same route - user friendly URLs
  • Next/Previous or Forward Only navigation - registration forms will probably use Next/Previous navigation; tests will probably use Forward Only
  • Looping - repeat one or more steps on a form as many times as needed
  • Plot Branching Navigation (PBN) - allows the form to decide which path to take depending on a user's response to questions
  • Step timeout - steps can have a timeout to ensure a user responds within a given time
  • Save/Restore - save partially completed forms then restore and continue from that point later
  • Event driven - write the handler functions and hook them up to events

For license information see the LICENSE-file.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist beastbytes/yii2-wizard

or add

"beastbytes/yii2-wizard": "*"

to the require section of your composer.json.

Usage

Below is a very short overview of how to use the extension; the examples folder shows how to implement PBN, looping, forward only navigation, and step timeout in examples of a quiz, survey, and registration.

Attach WizardBehavior to a controller.

The controller contains the event handlers; the two most important events are WizardBehavior::EVENT_WIZARD_STEP and WizardBehavior::EVENT_AFTER_WIZARD, these are responsible for handling the steps of the wizard and processing the data at the end of the wizard respectively.

Controller Action

The controller action is very simple:

public function actionWizard($step = null)
{
    return $this->step($step);
}

WizardBehavior::EVENT_WIZARD_STEP

This event's handler is responsible for validating submitted data and deciding in what direction the Wizard should proceed; this and the data to be stored is placed into the event. When the event is marked as handled by handler the wizard will take the appropriate action.

WizardBehavior::EVENT_AFTER_WIZARD

The handler for this event is responsible for taking the required action once the Wizard has completed; this could be rendering a page based on the user input and/or saving the data to persistant storage.

yii2-wizard's People

Contributors

beastbytes avatar freezy-sk avatar

Watchers

Vandro Neves dos Santos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.