Kbase P105694: How to stop a user from pressing the submit button multiple times in WebSpeed.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/02/2009 |
|
Status: Verified
GOAL:
How to stop a user from pressing the submit button multiple times in WebSpeed.
GOAL:
How to deactivate the submit button in WebSpeed.
FACT(s) (Environment):
WebSpeed 3.x
All Supported Operating Systems
FIX:
To keep a submit button from being pressed multiple times it is necessary to set a submitted flag and send a message to the user that the form has been already submitted.
This can be done using a small JavaScript function.
The following example shows two HTML files that show a way to do this, the formSubmit() function will block the submit key:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title> LIST.HTM : FILE WITH THE FORM AND THE JAVASCRIPT FUNCTION </title>
<script type="text/javascript">
function formSubmit()
{
var x=document.myForm
var val_s=x.submitted.value
if (val_s == "false" )
{
document.forms.myForm.submitted.value="true"
document.myForm.submit()
}
else
{
alert("Form has been already submitted !")
}
}
</script>
</head>
<body>
<form name="myForm" action="list2.htm" method="GET">
City: <input type="text" name="city" size="10" value=""><br />
<input type="hidden" name="submitted" value="false">
<input type="button" onclick="formSubmit()" value="Submit">
<input type="reset">
</body>
</html>
This second file is called list2.htm and contains the SpeedScript program:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>WebSpeed Script</title>
</head>
<body>
<script language="SpeedScript">
{&OUT} "<B> CUSTOMERS BY CITY </B> <BR> <BR>".
For each customer where city = get-field("city":U):
{&OUT} name " at " city " city" "<BR>".
END.
{&OUT} "<B> <I> **** THE END **** </I> </B>".
</script>
</body>
</html>