Close
Loading, please wait...
This announcement will hide in 60 seconds

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

News about Bubbling

Bubbling full API based on YUIDocs
Finally I got some time to review all the comments in the source code to generate the full API documentation based on YUI Docs, check the new documentation here. (new)

Accordion implementation to YUI 3.x
I spent some time creating a new plugin for YUI 3.x to implement the accordion features. Hopefully, this new plugin will be included within YUI 3.1 amoung other widgets and plugins. (hot)
- YUI3 Fork in github
- Check a preliminar example here

 
Follow Bubbling Library
 
Recommended Reading

Using the YUI TabView Control with the Dispatcher Plugin
YUI Dispatcher Plugin and how to use it along with the YUI TabView to load on-demand content using the YUI Connection Manager.

The Bubbling Technique & Custom Event, YUI’s Secret Weapon
In this article I’ll share my experiences in the event-driven programming within the web browser and show how the Bubbling Library, combined with YUI’s Custom Event capabilities, can create an unobtrusive behavioral layer suitable for powerful web applications.

Event-Driven Web Application Design
I recommend you to read carefully the Christian Heilmann's paper, where he wrote about how to plan an Event-Driven application, and how this technique will become the future of the web application as a result of an evolutive process.

A JavaScript Module Pattern
Eric Miraglia's detailed explanation of how to use the closures and specifically the module pattern (singlenton) as a flexible and multi-funcional structure...

 
Related Links

Yahoo! UI Library (YUI)
YUI Official Website at the Yahoo! Developer Network.

YUI Official Forum
Get help and share your knowledge thru the YUI Official Forum.

 
 
Linux MySql Server PHP Mozilla FireFox FireBug YAHOO! Bubbling Library