YUI Plugin: Form Manager (Wizard) - Documentation

2007-05-26

Simple Use Case: YAHOO.plugin.WizardManager

Markup (wizard container element):


  Inicial Message Here (optional link to display the wizard as a static page if the browser don't support javascript)

 

Script:
var myWizard = new YAHOO.plugin.WizardManager.add("mywizard", {uri:'/PATH/TO/WIZARD/start.php'});
The Manager will reset the wizard container, and fetch for the first page.

Singleton: YAHOO.plugin.WizardManager

YAHOO.plugin.WizardManager.add(str|HTMLElement|obj el, obj config);

Arguments:
(1) el: HTML ID or HTMLElement of existing markup to use as the wizard container.
(2) Configuration Object: JS object defining configuration properties for the Wizard instance. See Configuration section for full list.

Solutions:

Listen for a Wizard Event and make use of the Event's fields:
var myWizard = new YAHOO.plugin.WizardManager.add( "mywizard", {
    uri:'/PATH/TO/WIZARD/start.php',
    onSubmit: function ( w ) {
        alert ( 'Form Submition: ' + w.id );
    },
    onReady: function ( w ) {
        alert ( 'The new page is ready: ' + w.id );
    },
    onFinish: function ( w ) {
        alert ( 'The wizard finish successful: ' + w.id );
        // w.values -> literal object with the form values;
    }
});

Jump to new page:
You can analice the current status inside the events, and jump to another page if it needed.
YAHOO.plugin.WizardManager.jump("mywizard", '/PATH/TO/WIZARD/newpage.php');

Key Interesting Moments in Wizard

Events Fires Arguments
onReady ...when every step is displayed [0] {element: wizard DOM ref, values: literal with all form values}
onSubmit ...when every step is submitted (ideal for validation) [0] {element: wizard DOM ref, values: literal with all form values}
onError ...on connection error [0] {element: wizard DOM ref, values: literal with all form values}
onCancel ...click on cancel button [0] {element: wizard DOM ref, values: literal with all form values}
onFinish ...when the final step end (include all values as param) [0] {element: wizard DOM ref, values: literal with all form values}

Key Wizard Configuration Options

Option (type) Default Description
id (s) null The ID of the wizard container.
uri (s) empty URL of the wizard first page.
onReady (f) null Function for the corresponding moment
onSubmit (f) null Function for the corresponding moment
onError (f) null Function for the corresponding moment
onCancel (f) null Function for the corresponding moment
onFinish (f) null Function for the corresponding moment

This options can be set in the ADD second argument (eg, {id: 'mywizard', onReady: function( area ) {}})

Node

If YUI Button widget is available, the buttons inside the area will be automatically converted into yui buttons.


See the API Docs at full screen in a new window:

  http://www.bubbling-library.com/sandbox/api/index.hml

No Comment yet

Bubbling for YUI 3.x

Dispatcher (gallery-dispatcher)
The Dispatcher satisfies a very common need of developers using the YUI library: dynamic execution of Ajax response content. (new)

Node Accordion (gallery-node-accordion)
The Accordion Node Plugin makes it easy to transform existing markup into an accordion element with expandable and collapsible elements. Elements are easy to customize, and only require a small set of dependencies. (new)

Event Binder (gallery-event-binder)
Binding user actions until a particular YUI instance become ready, and the listeners defined before flushing those events through a queue. This will help to catch some early user interactions due the on-demand nature of YUI 3. (new)

Preload (gallery-preload)
Port of Stoyan Stefanov's JavaScript preload() function. It also has built-in support for Timer Idle to preload files only when the user is idle to avoid any overhead during the initial loading process. (new)

Parent Window Utility (gallery-parent-window)
This utility provides a set of functionalities to interact with the parent window. (new)

- See more modules by Caridy.

Bubbling Library is free open source software under the BSD License

(c) 2006 - 2010 Caridy Patino. All Rights Reserved.

This is one of my side projects, if you need something, just ask!