Develop > Presentation layer > Customize WebSphere Commerce Accelerator, Organization Administration Console, or Administration Console > Tools framework > Notebooks
Notebook JavaScript functions
To use the following JavaScript functions, first write code for the functions that implement the business logic. Once the code is written you can use these JavaScript functions in the notebook. Your JavaScript file is specified in the notebook's XML file.
Function Name Description submitErrorHandler(errMessage, errorStatus) Called when an error is received from the controller command. submitFinishHandler(finishMessage) Called upon successful completion by the controller command. submitCancelHandler() Called when Cancel then OK to confirm the cancel action is clicked. preSubmitHandler() Optionally called after the validateAllPanels() function, but before the finish controller command. validateAllPanels() Called when the user clicks OK. Parses the entire model, validating the information inside of it. If the data is not valid, the gotoPanel() function must be used to bring the user to the panel which contains the error. An error code is passed to this function identifying the error message to display. From the panel, the getErrorParams() function should be used to determine which error code was passed in. For more information, see Notebook error code handling.
You can use the following JavaScript functions in the notebook, they are implemented by WebSphere Commerce by default. The following functions are defined in the parent frame, and are called using parent.functionName():
Function Name Description get(key, defaultValue) Returns the value of the specified key from the object model. These keys are parameters stored in the parent or outside frame. The panel frame uses this function to get the values from the parent frame. remove(key) Removes the specified key from the object model. put(key, value) Stores the value for the specified key in the object model. These keys are parameters stored in the parent or outside frame. The panel frame uses this function to put values into the parent frame. setContentFrameLoaded(value) Sets the contentFrameLoaded variable to either true or false. If true, then the user is allowed to switch to a different content panel. If false, the user must wait until the panel has been loaded which sets the value to true.
- Note:
- You must call setContentFrameLoaded(true) at the end of the panel's onLoad() function. If this is not called, users will be stuck on the current content panel.
getRequestProperties() Gets the Request Properties. All parameters sent back to the navigation frame (provided they are strings) are put into a request property JavaScript hashtable. They can be accessed from the developer's code by calling the JavaScript function. addURLParameter(pname, value) Adds an additional URL parameter to the finish command. removeURLParameter(pname) Removes the URL parameter, previously added using the addURLParameter() function. gotoPanel(name) Saves the current panel information, then displays the selected panel.
Related concepts
Related tasks