Kbase 17079: Function example:populating a Selection list in Webspeed 2.x
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  6/12/1998 |
|
Function example:populating a Selection list in Webspeed 2.x
The following code example uses User Defined Functions (UDF)
to populate a selection list in an embedded SpeedScript file.
For further information on functions please see the on-line
help in Workshop e.g. under SpeedScript keywords.
The first html file contains a form with a selection list. On
Submit of the form another html file is run (outseln.r) - This
uses the get-value function to retrieve the highlighted
selection list entry.
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 2.0">
<title>Customer Navigation -</title>
</head>
<body bgcolor="#FFFFFF">
<script language="WebSpeed4GL">
/* repList() - a function that returns a selection list containing
* all the Salesreps in the database. */
function repList returns Character () :
def variable sList as Character no-undo.
sList = '<SELECT NAME="Sales-Rep" SIZE=10>~n'.
for each salesrep:
sList = sList
+ '<OPTION ' + 'VALUE=' + salesrep.sales-rep
+ '>'
+ salesrep.rep-name + '~n'.
end.
sList = sList + '</SELECT>~n'.
return sList.
end function.
</script> </p>
<form action="outseln.r" method="Get">
<hr>
<p align="left"><strong>Salesrep: </strong>`repList()`<strong><br>
<p align="left"><input type="submit" name="B1" value="Submit">
</p>
<hr>
</form>
</body>
</html>
/* outseln.html */
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta name="AUTHOR" content="Your Name">
<title>WebSpeed Script</title>
</head>
<body>
<P>The selected Sales-rep is - `get-value("sales-rep")`</P>
</body>
</html>
Progress Software Technical Support Note # 17079