Develop > Presentation layer > Customize WebSphere Commerce Accelerator, Organization Administration Console, or Administration Console > Tools framework > Notebooks


Notebook navigation behavior

Notebooks present users with one or more navigation options, as well as finish and cancel options, which are presented as buttons in the navigation frame at the bottom of the content window. Notebooks also provide panel navigation using the table of contents frame. When included, the navigation controls behave according to the following guidelines.

Panel Change

A user clicks on a panel in the table of contents frame other than the current panel:

  1. If a panel is still loading, do nothing while it finishes loading. Otherwise, continue to the next step.

  2. The savePanelData() function is called on the current panel to save its data into the object model.

  3. The validateNotebookPanel() function is called if it is defined. This ensures that the user has entered valid data. If there is a problem with this validation, this function returns false and does nothing by default. You should implement business logic to help the user enter correct data.

  4. Display the new panel. When the panel finishes loading, it must indicate this by calling the parent.setContentFrameLoaded(true); function. This stops the progress indicator in the tools UI center, and enables the Finish, OK, or Next buttons, thus allowing other panels to be selected.

Finish

A user clicks Finish or OK to finalize the interaction with the notebook:

  1. Check to see if the table of contents panel has finished loading. If not, return immediately and do nothing. Otherwise, continue to the next step.

  2. Check to see if Finish has already been clicked. If so, return and do nothing. If not, set a flag to indicate that Finish has been clicked.

  3. Call the savePanelData() function on the current panel to save its data into the object model.

  4. Call the validateAllPanels() function to perform validation on each panel, assuring that mandatory fields are completed, dates are in the correct form, and so on. If there are validation errors, you can set the content frame to the page containing errors. This function should be defined in the included JavaScript file, and because it does not belong to any individual panel, it is in the outer frame scope.

  5. Call the preSubmitHandler(). This function allows you to call any JavaScript that must run before the finish URL runs.

  6. If a finish command is specified, convert the model to XML and send it as a parameter to the finish command.

  7. Set a flag to indicate that the finish command is finished executing.

  8. If an error occurs in the finish server command (performing an update or otherwise), the command redirects back to the navigation frame passing back the following two parameters:

    SubmitErrorMessage

    The translated error message to display to the user.

    SubmitErrorStatus

    The corresponding error status or error code.

    If the SubmitErrorStatus variable is passed in, then the submitErrorHandler() function is called with the preceding two variables as parameters. You are responsible for implementing this function in the JavaScript file so that it displays the error message to the user, and redirects to the problematic input field based on the error code. If this function is not defined, a default alert window displays the error message.

    If the SubmitErrorStatus is not passed in, then it is assumed that the finish command succeeded.

  9. Call the submitFinishHandler() function with the submitFinishMessage as a parameter, which was set in the controller command.

Cancel

Displays a cancel confirmation dialog. If the user clicks OK, submitCancelHandler() is called, and then the parent frame's cancel method is run.

Error code handling

When validating for the notebook, you can display an error message from a resource bundle. The gotoPanel() function has an optional parameter: errorCode. The error code specified indicates what error has occurred. This error code is passed to the panel as an argument. Upon loading each notebook panel, check to see if any error codes have been passed in, using the parent.getErrorParams() function. If an error code has been passed in, display the appropriate error message for the error code. This means that each panel needs to be a JSP file so it can access the resource bundle.


Related concepts

Notebooks

Tools User Interface Center


Related tasks

Add a notebook

Related reference

Notebook JavaScript functions

Notebook definition


+

Search Tips   |   Advanced Search