Consultor Eletrônico



Kbase 17494: How to pass info from a frame to another frame of frameset
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   8/21/2003
Status: Unverified

GOAL:

How to pass info from a frame to another frame of frameset

FACT(s) (Environment):

WebSpeed 2.x
WebSpeed 3.x

FIX:

INTRODUCTION
============
This solution describes an example of passing information entered by a user in a frame to another frame of a frameset. This frameset has two frames, one which contains a text input field to accept a customer number and a link to run a web object in another frame which displays the customer name for the number entered.

FRAMESET HTML
=============
The following is the HTML for the frameset:

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<FRAMESET COLS="40%, *">

<FRAME SRC="frame1.r" NAME="first">
<FRAME SRC="main.r" NAME="main">

</FRAMESET>

Frame1.r is the web object in which the Customer Number is entered, this is a mapped web object. Main.r is an HTML file that displays a welcome message in the second frame of the frameset.

FRAME1
======
Frame1 is a web object which accepts the Customer Number entered by a user and then displays a Continue link which runs frame2 web object in the "main" target and passes the customer number as part of the URL format.

Here is frame1.html:

<html>
<head>
<title>Enter Information</title>
</head>

<body bgcolor="#FFFFFF">

<form method="POST">
<p>Enter customer number <input type="text" size="20"
name="Number"></p>
<p> <input type="submit" value="apply changes"> </P>
<p>&nbsp;</p>
</form>
</body>
</html>

frame1.html is then brought into the workshop and mapped and the
following line is added to the end of the IF REQUEST_METHOD = "POST"
of process-web-request:

{&OUT}
'Continue'.

END. /* Form has been submitted. */

FRAME2
======
Frame2 is an embedded Speedscript web object that takes the number passed from the link and finds the customer and displays the customer name.

Here is frame2.html:

<html>
<head>
<title>WebSpeed Script</title>
</head>

<body>
<script language="SpeedScript">
DEFINE VAR num-entered AS INTEGER.

ASSIGN num-entered = INTEGER(GET-VALUE("num")).

FIND FIRST Customer WHERE Customer.cust-num = num-entered
NO-LOCK NO-ERROR.
IF AVAILABLE Customer THEN
{&OUT}
"Customer Number " + STRING(num-entered) + " is " + Customer.Name.
ELSE {&OUT}
"Customer Number " + STRING(num-entered) + " does not exist".
</script>

</body>
</html>

MAIN
====
Main.r is an HTML file that has been saved in the workshop that
initially displays in the main target frame.

Here is the HTML for main:

<html>
<head>
<title>WebSpeed Script</title>
</head>

<body>

<H1>Welcome to frameset example</H1>

</body>
</html>


-----------------------------------------------------------

If you would like to run form2 with directly passing values by 'Submit' button, in the above case by clicking on 'Apply Changes' button and without using 'Continue' button then make the following changes in the above code.

- Replace the following line from frame1.html:
<form method="POST">
with the following line,
<form action="frame2.r" method="POST" target="main">

- Replace the following line from fram2.html:
ASSIGN num-entered = INTEGER(GET-VALUE("num")).
with the following line,
ASSIGN num-entered = INTEGER(GET-VALUE("number")).