Kbase P31866: How to dynamically generate Text input fields in Webspeed ba
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  25/11/2003 |
|
Status: Unverified
GOAL:
How to generate text input fields in Webspeed based on a database table?
FACT(s) (Environment):
WebSpeed 3.x
FIX:
Using a combination of the {&out} and a for each statement you can generate HTML text fields for a table as needed.
The following Webspeed example uses the Sports2000.db
/*---------------------------------------------------------------------------*/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<META NAME="AUTHOR" CONTENT="Alex Pearlstein">
<TITLE>WebSpeed Script</TITLE>
<SCRIPT LANGUAGE="SpeedScript">
/* Create an unnamed pool to store all the widgets created by this procedure.
This is a good default which assures that this procedure's triggers and
internal procedures will execute in this procedure's storage, and that
proper cleanup will occur on deletion of the procedure. */
CREATE WIDGET-POOL.
Define Variable i as integer no-undo init 1.
</SCRIPT>
</HEAD>
<BODY>
<Table>
<SCRIPT LANGUAGE="SpeedScript">
FOR each customer where customer.custnum < 10:
{&out} '<TR><TD>' i '</TD><TD><input type="text" size="20" name="tcustname' + String(i) '" value="'Customer.CustNum '"></TD><TD><input type="text" size="20" name="tcustNum' + String(i) '" value="'Customer.name '"></TD></TR>'.
i = i + 1.
END.
</SCRIPT>
</Table>
</BODY>
</HTML>