Consultor Eletrônico



Kbase 18421: How To Use JavaScript With Progress WebSpeed To Do Input Editing
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Unverified

GOAL:

How to use JavaScript with Progress WebSpeed to do input editing.

FACT(s) (Environment):

WebSpeed 3.x

FIX:

The files shown in the example can be found in the following locations:

- wsverify.p is in the src/web/examples directory.

- inputchk.htm is at the end of this Solution.

- tagmap.dat is in the installation (DLC) directory.

Follow these steps:

1) Add the following line to the tagmap.dat file that is in the
install directory of the machine where the WebSpeed
Transaction Server lives.

!--WSVERIFY,,,fill-in,src/web/examples/wsverify.p

(wsverify.p is a SpeedScript procedure that makes some
pre-written JavaScript routines available to the
WebSpeed object.)

2) Restart the WebSpeed broker to activate the new tagmap.dat
file.

3) Move the following file to your working directory:

src/web/examples/inputchk.htm

If you look at this file, you see the following HTML
tag:

<!--WSVERIFY NAME="VerifyInclude">

This tag causes wsverify.p to be run. It inserts
JavaScript routines such as IsNumberChar into the
run-time HTML that can be called for input validation,
as in the following lines from inputchk.htm:

<P>Enter a number: <INPUT NAME="Mynum" SIZE="20"

onBlur="JavaScript:WSTextVerify(Mynum,'9(5)')"><BR>

4) Using AppBuilder, create a new HTML mapping object mapped to
inputchk.htm.

NOTE: Even though no fields are mapped in this mapping
object, you must still name a database as the datasource. If
you look at the created file (inputchk.off), you should see
an entry for the WSVERIFY tag similar to the following:

field[1]= "VerifyInclude,!--WSVERIFY,,fill-in,12,1,12,34"

If you do not see an entry for WSVERIFY, you might need to
extract the inputchk.off file using WebTools.

5) After you complete the HTML mapping step, save and run the
finished object.

NOTE: The JavaScript prevents any input except a five-digit
number. The error is caught when the focus leaves the input
field.

/******** inputchk.htm file *****************************/

<!DOCTYPE HTML PUBLIC
"-//Netscape Corp.//DTD HTML plus Tables//EN" "html-net.dtd">

<HTML>
<HEAD>
<TITLE>Sample HTML file</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1>JavaScript Input Editing with WebSpeed</H1>
<p> To run this demo, the following line must be added to the
tagmap.dat file in your WebSpeed install directory of
the WebSpeed Transaction Server:
</p>
<p> !--WSVERIFY,,,fill-in,src/web/examples/wsverify.p
<FORM ACTION="inputchk.w" NAME="In_Chk" METHOD="POST">
<!--WSVERIFY NAME="VerifyInclude">
<P>Enter a number: <INPUT NAME="Mynum" SIZE="20"
onMouseOver=
"window.status='This is an input test!';return true"
onBlur="JavaScript:WSTestVerify(Mynum,'9(5)')"><BR>

<ul>
<li>This field accepts only 5 digit numbers. Type in
3 digits and tab to see the JavaScript input edit.</li>

</ul>

<p>This sample shows how JavaScript can be used in conjunction
with WebSpeed for simple input editing. The use of the custom
WSVERIFY tag shows how the JavaScript can be easily reused in
other WebSpeed objects. These are the files used in this simple demonstration:</p>
<ul>
<li>install-directory/src/web/examples/wsverify.p</li>

</ul>

</P>
</FORM>
</BODY>
</HTML>