Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
SpeedScript : Building interactive Web pages with embedded SpeedScript : Managing dynamic pages with forms : Defining local data and getting input
 
Defining local data and getting input
The following sections describe several sections of this template. A <SCRIPT> tag introduces the first SpeedScript references in the HTML body (edited for brevity):

Part 1 of browse.html

<SCRIPT language="SpeedScript">
  /* Modify the "&SCOPE-DEFINE..." lines to customize this browse. */

  &SCOPED-DEFINE Query-Table Customer
  &SCOPED-DEFINE Query-Field Name
  &SCOPED-DEFINE Query-Index Name
  &SCOPED-DEFINE Filter-Field Salesrep
  &SCOPED-DEFINE Display-Fields "<TR><TD>" Customer.Name "</TD><TD>"~
    Customer.Cust-num "</TD></TR>"
  &SCOPED-DEFINE Result-Rows 10

  DEFINE VARIABLE jumpto-value        AS CHARACTER NO-UNDO.
  DEFINE VARIABLE {&Filter-Field}-key AS CHARACTER NO-UNDO.
  DEFINE VARIABLE repo-to             AS INTEGER   NO-UNDO.
  DEFINE VARIABLE iCount              AS INTEGER   NO-UNDO.
  DEFINE VARIABLE JumpForm            AS CHARACTER NO-UNDO.
  DEFINE VARIABLE TmpUrl              AS CHARACTER NO-UNDO.
  DEFINE VARIABLE DelimiterField      AS CHARACTER NO-UNDO.
/* Get all the fields from the input */
ASSIGN
JumpForm            = get-field("NoJumpForm":U)
jumpto-value        = get-field("jumpto-name":U)
repo-to             = INTEGER(get-field("repo-to":U)) NO-ERROR.
{&Filter-Field}-key = get-field("{&Filter-Field}":U).
/* Display "Jump To" Form. This form will not be displayed if
"NoJumpForm=yes" requested */
IF JumpForm EQ"":U THEN DO:
</SCRIPT>
Here, the file defines the local Web object environment, including customizable preprocessor definitions. Several calls to the get-field API function return user input for each request. Of particular interest is the get-field("NoJumpForm":U) call that returns a URL query string value. This initial script section terminates by testing this value to determine whether to generate a form to output on the next request. Note that the SpeedScript terminates with a DO statement header, thus beginning a SpeedScript DO block.