Kbase 20308: How to Pass the Same Value Again to a Web Object
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  02/07/2008 |
|
Status: Unverified
GOAL:
How to Pass the Same Value Again to a Web Object
FIX:
WebSpeed development allows you to pass a value between web objects using different methods (form fields, hidden fields, cookies etc.). An frequently asked question is how to pass the same value again to the same or different web object. The example code below uses the same web object to pass the value again. It can be easily changed to a different program using FORM ACTION:
Follow these steps to pass the value:
1) Create an HTML program called 'test.html' as follows:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"
<html>
<head>
<title>WebSpeed Script</title>
</head>
<body>
<form action="prog2.r">
<p>Enter Customer Number:
<input type="text" size="20" name="cnum"></p>
<input type="hidden" name="myval" value="abc">
<p><input type="submit" name="B1" value="Submit"></p>
</form>
</body>
</html>
2) Create another HTML program called 'prog2.html' as follows:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>WebSpeed Script</title>
</head>
<body>
<H2> Now running second program! </H2>
<script language="SpeedScript">
IF request_method = "get" THEN do:
Find customer where custnum = int(get-value("cnum")).
{&OUT} "Customer number = " get-value("cnum") SKIP.
{&OUT} "Name = " name SKIP SKIP SKIP.
{&OUT} "Value passed = " get-value("myval") SKIP.
</script>
<form action="prog2.r" method="POST">
<p>Enter any value:
<input type="text" size="20" name="num"></p>
<input type="hidden" name="myval" value="`get-value("myval")`">
<p><input type="submit" name="B2" value="Submit"></p>
</form>
<script language="SpeedScript">
end.
</script>
<script language="SpeedScript">
IF request_method = "post" THEN do:
{&OUT} "Entered value = " get-value("num") SKIP.
{&OUT} "Passed Value = " get-value("myval").
END.
</script>
</body>
</html>