Hyperlink Web component

The Hyperlink Web component creates a hypertext link that when clicked, opens another file.

General tab (iwcl:WHyperlink)

Name
Enter a unique identifier for the iSeries Web component. Do not use blanks or hyphens in a name. See Rules for iSeries Web component names and values.
URL
Indicate the absolute or relative path for the Web page that is to be displayed in the browser. See the description for Delimiter for information about dynamically changing the URL. Also see Substitution variables in hyperlink Web components for information about using substitution variables in the URL field.
The first part of the URL is the protocol, such as http:. Other protocols include ftp:, news:, mailto:. You can use the mailto: protocol to invoke the mail client on the user's workstation. For example, if you returned the following value in the parameter, and the user clicked on the link, the default mail client would start with a new mail window:
mailto:joe@somecompany.com | Send mail to Joe
In addition, you can add a subject parameter to the prefilled message subject field:
mailto:joe@somecompany.com?subject=Hello Joe | Send mail to Joe
Other parameters include body, for message text, cc, and bcc. Not all browsers support these additional parameters. Check your browser documentation. If you want to include these parameters, you specify them as follows:
mailto:joe@somecompany.com?subject=Hello Joe&cc=Pete&body=Hello Joe.
Text
Enter a text description that appears on the page as the hypertext link. For example, if the URL is http://www.abc.com/, the text for this link could read Click here to open our Web site. See the description for Delimiter for information about dynamically changing the text. Also see Substitution variables in hyperlink Web components for information about using substitution variables in the text field.
See Text string substitution for iSeries Web component labels for information about externalizing text strings for text substitution purposes.
Delimiter
Enter the delimiter character used to identify a URL and text description returned from the host program. The default character is a vertical bar ('|'). For example, leave the URL and Text attribute fields blank if your host program returns the hyperlink in the form http://www.ibm.com|IBM home page. In this case, the vertical bar delimiter is used to separate the URL from the link text. The text portion is the link that the user clicks on the page. If the text portion of the hyperlink will not change, you specify the text in the Text attribute field, and your host program can return the URL portion of the link (without the vertical bar), for example http://www.ibm.com. In this case, the URL returned from the program is associated with the text description specified in the Text attribute field. In this latter example, if you leave the Text attribute field blank, the URL returned from the host program is also used as the text description.
Target
Specify the value to indicate how the target of the hyperlink is displayed. The possible values are name, New Window, Same Frame, Parent Frame, or Full Screen. (You can also type a name in the Target field to indicate the name of the frame in which to display the target page of the hyperlink.)
New Window
Indicates that the target page appears in a new, separate, browser window.
Same Frame
Indicates that the target page opens in the same frame as the page with the hyperlink.
Parent Frame
Indicates that the target page opens in the parent frame set.
Full Screen
Indicates that the target page opens in the full body of the browser.
Initial state
Select Disabled or Hidden.
Disabled
Indicates that the Web component is not available for use.
Hidden
Indicates that the Web component is not visible on the page.
Tool tip
Enter the description to be displayed when the mouse pointer is on the Web component.
See Text string substitution for iSeries Web component labels for information about externalizing text strings for text substitution purposes.
Access key
Specify a character to be associated with a shortcut key that a user selects to bring focus to the Web component.
Tab index
Enter a number for the tab order of the Web component that is created. For example, a value of 1 means that this Web component is the first object to receive focus in the tab sequence.

Events tab

Events
Choose any of the events in the list and use the JavaScript language to code an action for that event in the Script field. For example, if you select OnBlur , you might code the script alert("not applicable");. For a brief description of the events that apply to this Web component, see Web component events.

Styles tab

The Styles tab contains inline style options for the iSeries Web component.
Inline Style
Select the Fonts, Font styles, Background Color, and Text layout buttons to open the respective style definition windows. Use each window to select the options that you want to apply to the iSeries Web component.

Substitution variables in hyperlink Web components

You can use the Hyperlink Web component as a standalone Web component, or you can embed it in a Table Web component. Each use gives you the option of encoding substitution variables for the URL and the Text fields.

As a standalone Web component, you enter the variable within braces in the static URL and text fields. The variable is the name of the Web component. As shown in the following image, the Web component name is HYPERLINK1. Therefore the substitution variable is also entered as HYPERLINK1.
The general tab in the Attributes view for the Hyperlink Web component. The URL and Text fields show the substitution variable within braces

If a variable is included in the static URL or Text fields, then at run time the URL and text is formed by replacing the substitution variable with the value returned by the host program. The value returned by the host program can have a URL portion and a label portion in the form url | label. The delimiter distinguishes the URL and the label. For example, if the value returned from the host program is http://www.ibm.com | Link to IBM, the substitution variable in the static URL is replaced by the URL portion of the value returned by the host program. Similarly, the substitution variable in the static text is replaced by the label portion of the value returned by the host program.

In another example of replacing a variable in the URL and Text fields of a hyperlink, assume that a hyperlink on a page displays the name of an employee's manager. In this case, the hyperlink name is managerlink, with a URL of getperson.do?personid={managerlink}. The Text is specified as {managerlink}.
The General tab in the Attributes view  for the Hyperlink Web component. The URL and Text fields show the substitution variable managerlink within braces.
The Hyperlink Web component is mapped to an output field in the host program. If the program returns a value of 1085 | Doe, John, the URL portion of the hyperlink is 1085 and the label portion is Doe, John. When the page displays, the text Doe, John appears as the hyperlink label, and the {managerlink} variable in the URL is replaced with 1085, which results in the hyperlink URL value of getperson.do?personid=1085. When the user clicks the link, information about the manager is displayed.

You can also embed Hyperlink Web components into a Table Web component by specifying the column type as Hyperlink, as shown below.
The Column tab in the Attributes view of the Table Web component. The Hyperlink Web component is specified in the Type column, and a button to open the Column Properties dialog is in the Properties column

When you click the button in the Properties column, the Column Properties dialog opens, in which you can enter the static URL and static text. You can also include substitution variables enclosed in braces, as shown below.
The Column Properties dialog illustrating entries in the URL and Text fields, each containing substitution variables enclosed in braces

In this example, the substitution variables col1 and col2 are valid column names that are specified for the Table Web component. At run time, the substitution variables are replaced with the data from the specified table column. Note that only the data is used from the specified table column. For example, if the specified table column is a Combo Box Web component, then the data from that column is returned in an array of name:value:true|false. This data is used as is, and it is not parsed to extract any special format. However, if the substitution variable specifies a column that is a hyperlink field, the value used for replacing the substitution variable depends on where the substitution variable is specified. If it is specified in the static URL field, it is replaced with the URL portion of the value returned by the host program. Otherwise, the substitution variable is replaced with the text portion of the value returned by the host program.

In the following example, you can use substitution values in a Hyperlink Web component that is used in a subfile.


The Design view of a subfile in a JSP file.
The Name column is a hyperlink and the ID column is hidden. The subfile is designed so that when a user clicks a name under the Name column in the subfile, the hidden ID associated with that name is passed to a JavaScript function. The columns for the subfile are defined as follows:
The attributes for the subfile that is on the JSP page.
The hyperlink properties for the name column includes the JavaScript in the URL field shown here:
The Column Properties dialog box showing the URL and Text values for the hyperlink used in the name column.
The values within the braces are the names of the columns in the subfile. The values in this dialog box indicate that the text for the name column hyperlink is the value in the name column. The URL for the hyperlink is a call to a JavaScript function getperson, which passes the value in the hidden column hid.