Setting up page navigation
One of the
major tasks when creating a set of Web pages is managing how one page
links to another and how data is passed from one page to the next.
4GL Web pages help manage page data accurately and efficiently when
a Web application requires navigation from one page to another.
About page navigation
On 4GL Web pages, the type of link you use determines how
data gets passed from a linking page to a target page.
Navigation styles
You can link
from one page to another using any of three navigation styles:
- A hyperlink using the HTML <A> element
- A form submit for the page
- A server redirection using self-navigation (where
the form representing the current page submits back to itself)
All three styles let you bind parameters to target pages,
but the level of support for binding varies. Which navigation style
you choose depends on how you want data passed, whether or not the
data requires processing by the server, and the flexibility you
need.
Most 4GL Web pages navigate to other pages by server redirection.
It presents the most flexible way to navigate from one page to another.
Summary of advantages and disadvantages of navigation
styles These are the advantages and disadvantages of the three navigation
styles:
Navigation | Advantages | Disadvantages |
---|---|---|
Hyperlink |
|
|
Form submit |
|
|
Server redirect |
|
|
Target pages
When
you develop Web pages, you can specify a target page that already
exists, or one that you plan to create. If you specify a page that
already exists, you can bind values from the linking page to the
parameters of the target page. If you specify a page that does not
yet exist, you can set parameters on the linking page; then, when
you create the target page, you specify which parameters it requires
of those being passed from the linking page. For more information about
page parameters, see “Setting up page parameters”.
Parameter binding
When you establish
navigation from one page to another, you can bind values from the
linking page to parameters on the target page. 4GL Web pages support several
types of parameter bindings:
Type of binding | Description | Navigation style restrictions |
---|---|---|
Constant | A fixed value | Not available for form submit. |
Page Variable | A variable whose value is set on the server | Only initial value used by hyperlink (cannot be changed by client). Variable name must match parameter name on target page for form submit. |
Page Parameter | A parameter whose value is set on the server |
Only initial value used by hyperlink (cannot be changed by client). Parameter name must match parameter name on target page for form submit. |
Expression | The value of an expression set on the server |
Not available for form submit. |
Control | The value property of a server object | Not available for hyperlink. |
The user interface for binding parameters is different for
each navigation style:
Navigation style | For information, see |
---|---|
Hyperlink | “Managing client hyperlinks” |
Form submit | “Managing client form submission” |
Server redirect | “Managing server redirection” |
Managing client hyperlinks
For client hyperlinks, an HTML anchor <A> element
directly links one page to another. On the linking page, you specify
the parameters (including the type of binding and the value for
the parameter) you want to pass to parameters on the target page.
The following drawing illustrates how parameters are made
available to a target page from a hyperlink on a linking page in
a Web site target. Parameters are passed the same way for JSP targets,
except that the target and linking pages would typically have .jsp extensions
instead of the .htm extensions displayed in
the drawing:
The server sets the parameters sent to the target page. Only
initial values are passed to the target parameters; client-entered
values are not processed.
To pass parameters with a client hyperlink:
-
Drag an HTML A element
from the Language tab of the System Tree to a 4GL Web page in the
HTML editor (Page or Source view).
or
Click
the hyperlink tool button in the painter bar for the HTML editor
with a 4GL Web page open in Page or Source view.The Hyperlink Properties dialog box displays.
-
On the Hyperlink page, specify link information,
including a target page destination.Make sure the Server-Side Scriptable check box is selected.
-
On the Parameters page, specify page parameters
for the target page, the type of binding for each parameter, and
the value from the current page that you want to bind to each parameter.If the target page exists and has page parameters defined
for it, these parameters display automatically under the Parameter
Names column. They are available for binding to constants, expressions,
page parameters, and page variables from the current page.You can add new parameters to the list and define them later
in the target page. Parameters and variables on the current page
automatically display under the Bind Value column when you select
a bind type of Page Parameter or Page Variable, respectively. -
Click OK after you finish setting the hyperlink
properties.
Managing client form submission
On
4GL Web pages, a form represents a page
. When
a user action submits a page form, the form can submit to the same
page (self-navigation) to refresh a page in the user’s
browser or to prepare for a server redirection. Otherwise, it can
be submitted directly to another page (form submit). For more information about
server redirection, see “Managing server redirection”.
When a form submits directly to another page, the data passed
to the target page must already be available from the linking page.
The following data is available to the target page:
- Values for server-scriptable controls
- Client-side parameters (including parameter values
set on the client)
For a form submit, the names of the client controls must map
to (match) the names of the parameters on the target page. To take
advantage of the Web Target interface for the form submit navigation
style, you must first set the parameter names on the target page.
The 4GL Web page does not provide parameter and variable management
for forms directly submitted to another page.
No forms on 4GL Web pages You should not add FORM tags to 4GL Web pages. If you change
a non-4GL page to 4GL mode, you must manually remove any FORM tags
in Source view. For 4GL Web pages, the entire page is represented
as a single form.
The following drawing illustrates how parameters get passed
when a page form submits directly to another form in a Web site
target. Parameters are passed the same way for JSP targets, except
that the target and linking pages would typically have .jsp extensions
instead of the .htm extensions displayed in
the drawing:
For a fuller description of how to pass parameters using the
form submit navigation style, see “Using parameters and variables”.
To set parameter bindings:
-
Right-click the linking page in the HTML
editor, then select Page Properties from the pop-up menu.The Page Properties dialog box displays.
-
Click the Parameters tab.
or
Click the Variables tab.
-
Click the New button, and add a parameter or variable
with the same name as a parameter on the target page.For parameter binding purposes, the names you type are case
sensitive. The parameter or variable name on the linking page must
exactly match the parameter name on the target page.For steps to add a parameter, see Setting up page parameters. For steps to add a variable, see Setting up page and session
variables. -
Repeat steps 2 and 3 for each parameter and variable
you want to add to the current (linking) page. -
Click the Destination tab on the open (linking)
page. -
Select the Submit To URL radio button option.
Click the browse (…) button and select your target
page from the Choose URL dialog box.The parameters of the target page are listed in the Parameter
Name column of the grayed-out list box. You cannot directly modify
the items in this list.If a parameter or variable name on the current (linking) page
matches a parameter on the target page, the matching name is listed
in the Bind Value column. The Bind Type indicates whether the matching
name is a page parameter or page variable on the current page. - Click Apply.
Managing server redirection
4GL Web page navigation
4GL
Web pages provide added support for navigation between pages. Server redirection
is the navigation style of choice when a parameter value passed
to another page relies on user input, or when you want to validate
user input. The 4GL Web page generates the server script that specifies
the target page and the values that get passed to parameters on
the target page.
A server redirection can initiate a link to another page from
anywhere in a server script. Typically you add a Redirect call
in a ServerAction event for a command or picture button, or in the
AfterAction event for the psPage object or a Web DataWindow control
that you place on the page.
All server data is available for parameter binding, because
the redirection occurs in the server script. The page gets processed
by the server, enabling the page to take advantage of all variables
available there. Because the ASP object model does not support 4GL
functionality, server redirection is not available for ASP targets.
The following drawing illustrates how parameters get processed
in a PowerDynamo application when a server redirection displays
another page. Parameters are passed the same way for JSP targets,
except for the application server name. Also, the target and linking
pages in a JSP application would typically have .jsp extensions
instead of the .htm extensions displayed in
the drawing:
Setting up a server redirection
You can set up a server redirection from the integrated Script
editor by selecting a server event, then specifying the target page
and the parameters to pass to that page. The script is created for
you.
To set up a server redirection from the integrated
Script editor:
-
In a server script or in the script for
a control with a server action event selected in the events list,
right-click in the Script editor. - Select Insert Redirect from the pop-up menu.
-
In the Redirect Properties dialog box, specify
the target file or URL. -
Specify the target page parameters, the type of
binding for each parameter, and the value you want to bind to the
parameter.If the target page exists with input parameters identified
for it, these parameters appear in the list of parameters on the
Redirect page. You can edit these parameters and add new ones. -
When you finish setting the Redirect Properties,
click OK.The Script editor inserts a block of code. You can modify
or remove this block of code using the pop-up menu.
Changing parameter bindings
You can change the binding for parameters from the Redirect
Properties dialog box.
To change parameter bindings or parameter values
for a server redirection:
-
Right-click in the Redirect code in the
integrated Script editor. - Select Edit Redirect from the pop-up menu.
-
In the Redirect Properties dialog box, make any
changes needed to the parameter definitions.