Zapatec.Wizard

Overview | File | Class | Tree | Index | Help

Zapatec Utils

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class Zapatec.Wizard

    Object
       |
       +--Zapatec.Wizard

class Zapatec.Wizard

Defined in wizard.js

Field Summary
`boolean` | `onBeforeTabChange` Called when the tab is about to be changed, just _before_.
`Object` | `onInit` Called when the wizard is created.
`Object` | `onTabChange` Called _after_ the tab was changed.

Constructor Summary
`Zapatec.Wizard(<object> args)` Zapatec.Wizard constructor.

Method Summary
`Object` | `addCustomValidator(name, func)` Create a custom validator.
`void` | `addValidator(name, regexp, error)` Add a simple validator.
`Object` | `changeTab(<string> newTab)` Display a new tab.
`void` | `firstTab()` Move to the first tab.
`string` | `getCurrentTab()`
`void` | `init()` Initializes the wizard.
`boolean` | `isFirstTab()`
`boolean` | `isLastTab()`
`void` | `lastTab()` Move to the last tab.
`Object` | `nextTab()` Move to the next tab.
`Object` | `prevTab()` Move to the previous tab.
`object` | `setupNav(<object> parent)` Creates a default navigation bar for the wizard and appends it into the given parent.
`void` | `toggleAdvanced()` Toggles "advanced mode" for the currently displayed tab.
`boolean` | `validate(<string> value, <string> validator, args)` Call this function given the value and the validator to match it against.
`<static> Object` | `_doNothing()` A "do nothing" handler used for default event hooks.

Field Detail

### onBeforeTabChange

    boolean onBeforeTabChange

Called when the tab is about to be changed, just _before_.

### onInit

    Object onInit

Called when the wizard is created. Users can perform problem-specific initializations at this stage. No arguments.

### onTabChange

    Object onTabChange

Called _after_ the tab was changed.

Constructor Detail

### Zapatec.Wizard

    Zapatec.Wizard(<object> args)

Zapatec.Wizard constructor.

     A Wizard object provides common functionality that seems to be required by
     any wizard:

      - tabbed display
      - keyboard navigation through tabs
      - tab navigation bar (

Parameters:

`args` - Contains the arguments to be used, as described above

Returns:

A new Zapatec.Wizard object

Method Detail

### addCustomValidator

    Object addCustomValidator(name, func)

Create a custom validator. You need to specify the ID of the validator, and a function that does the validation checks. The function specification is simple:

        function validate(value, args, validator);

     The 3 arguments are:

     - value -- the value that we should check validation against; usually the
                \em value attribute of the input field.
     - args -- any arguments that might be passed to the validator in the class
               name.  Note that this might be null.
     - validator -- the ID of the validator, useful if you wish to use the same
                    handler function for multiple validators.

### addValidator

    void addValidator(name, regexp, error)

Add a simple validator. Pass the regexp that should match and the error message that should be displayed if it doesn't.

### changeTab

    Object changeTab(<string> newTab)

Display a new tab. This function also takes care of (re)setting the visibility of buttons in the navigation bar, and of calling the appropriate event hooks. If "onBeforeTabChange()" returns false, the operation is cancelled.

Parameters:

`newTab` - ID of the new tab

### firstTab

    void firstTab()

Move to the first tab.

### getCurrentTab

    string getCurrentTab()

Returns:

ID of the currently displayed tab

### init

    void init()

Initializes the wizard. Developers should call this function after creating a wizard and assigning any event handlers and/or creating the standard toolbar (with Zapatec.Wizard.setupNav()).

### isFirstTab

    boolean isFirstTab()

Returns:

true if we are at the first tab, false otherwise

### isLastTab

    boolean isLastTab()

Returns:

true if we are at the last tab, false otherwise

### lastTab

    void lastTab()

Move to the last tab. Usually needed by buttons like "finish wizard".

### nextTab

    Object nextTab()

Move to the next tab.

### prevTab

    Object prevTab()

Move to the previous tab.

### setupNav

    object setupNav(<object> parent)

Creates a default navigation bar for the wizard and appends it into the given parent. The default buttons are:

      - "advanced mode" (only visible if the current tab has advanced elements)
      - "Begin" (moves to first tab)
      - "Prev." (moves to previous tab)
      - "Next" (moves to next tab)
      - "End" (moves to last tab)

     Any of these buttons is assigned a certain class name, which helps
     customizing the look through external CSS.  The classes are (in the same
     order as above): "btn-advanced", "btn-begin", "btn-prev", "btn-next",
     "btn-finish".

Parameters:

`parent` - the parent of the tab navigation bar

Returns:

Reference to the DIV containing the navigation bar

### toggleAdvanced

    void toggleAdvanced()

Toggles "advanced mode" for the currently displayed tab. This operation involves displaying or hiding any fields that have the class "advanced". This is actually achieved by simply adding or removing the class to those elements, accordingly.

### validate

    boolean validate(<string> value, <string> validator, args)

Call this function given the value and the validator to match it against. WARNING, this function throws an exception if the validator is not defined. You do not normally need to call this function manually, as all the validation checks are being done automatically when the field requiring validation loses focus.

Parameters:

`value` - the string to test

`validator` - the validator name

Returns:

true if it validates, false otherwise

### _doNothing

    <static> Object _doNothing()

A "do nothing" handler used for default event hooks.

Overview | File | Class | Tree | Index | Help

Zapatec Utils

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Documentation generated by JSDoc on Thu Aug 16 12:18:39 2007