5.1.1 Using the onClick Handler

For simple hyperlinks, use the 'Hyperlink' dialog box: See Hyperlinks in the Report Design.

The onClick handler is executed on the report server, as are all scripts. Because the handler does not execute on the client browser, it cannot perform client-side actions directly. Instead, the handler controls the behavior of the report by returning one of the pre-defined viewer actions. Actions related to hyperlinks are showReplet() and showURL(). Other viewer actions are discussed in a later chapter.

Note: The viewer action functions (showReplet, sendRequest, etc.) should be the final statement of the onClick script.

The onClick handler is primarily used for Tables and Text elements, in situations where you cannot completely define the hyperlinks at design time. For example, if a hyperlink is required to pass parameters that might change as a result of user interactions, you can compute the parameter values in the onClick handler, and then create the hyperlink by using the showReplet() action.

For example, consider the following onClick script attached to an element. When the user clicks the element, the script tests a condition, and then loads one of two possible reports.

if(condition) {

   showReplet("order info",[["start_date",CALC.today()]]);

}

else {

   showReplet("customer info",[["state", "NJ"]]);

}

See Also

Style Intelligence Global Object, for a list of available viewer functions.

<< 5.1 onClick Handler © 1996-2013 InetSoft Technology Corporation (v11.5) 5.1.2 Setting the onClick Range >>