Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
SpeedScript : Building interactive Web pages with embedded SpeedScript : Managing dynamic pages with forms : Managing SpeedScript blocks and conditional execution
 
Managing SpeedScript blocks and conditional execution
The next section is a small script section that begins by closing this DO block:

Part 3 of browse.html

<SCRIPT language="SpeedScript">
END. /* Close of "IF JumpForm EQ "":U THEN DO:" */

/* Display "Results List" if "Jump To" Form posted or
"NoJumpForm=yes" requested */
IF repo-to NE 0 OR JumpForm NE"":U THEN DO:
</SCRIPT>
<P ALIGN="center"><STRONG>Results List:</STRONG></P>
<DIV ALIGN="center"><CENTER>
<TABLE BORDER="2">
This script section ends by starting another DO block if the Web object is either handling a POST from the form or running without generating the form. Note that the Jump To form includes hidden fields, including repo-to with a nonzero value to indicate that the form was displayed and the user is submitting it to return a query. This DO block begins with HTML preprocessed into SpeedScript to start a centered HTML table that handles the query output 10 items (Result-Rows) at a time.
The next script section includes the actual query code included in the DO block to resolve, reposition, and output the query rows, based on user input. To simplify embedded SpeedScript interaction between SpeedScript and HTML, this SpeedScript code also includes the necessary HTML to specify each row of the HTML table for the query. The table row is specified by the preprocessor reference {&Display-Fields}, which is defined in the first script section of the embedded SpeedScript file. (The actual query resolution and output is beyond the scope of this description. For more information, see the install-path/src/web/browse.html template.)
Following the query resolution and output section is another mixture of HTML and embedded SpeedScript code that concludes the query DO block:

Part 4 of browse.html

</TABLE>
</CENTER></DIV>
<SCRIPT LANGUAGE="SpeedScript">
  /* If not the end of the query, increment reposition pointer for navigation.
     If end of query, force query to start from beginning. */
    repo-to = IF NOT AVAILABLE {&Query-Table} THEN -1
              ELSE CURRENT-RESULT-ROW("Browse-Qry":U) + 1.
  END. /* Close of "IF repo-to NE 0 OR JumpForm NE "":U THEN DO:" */

/* Display navigation links unless we are waiting for the very first "Jump
     To" to be submited. */
IF repo-to NE 0 THEN DO:

TmpUrl = url-format(?,'jumpto-name,{&Filter-field},NoJumpForm',?).
    DelimiterField = IF INDEX(TmpUrl,"?") GT 0 THEN ? ELSE "?".
</SCRIPT>
This section also starts another DO block that begins by setting up the initial contents of the URL query string for any following request driven by a navigation panel (yet to be output).