You have a multi-page data entry form in which the final page requires data entered on pages that precede it. You need to pass the data gathered on previous pages to the current page.
Pass the name/value pairs from previous pages using the htp.formHidden
procedure in the PL/SQL Web Toolkit. In this recipe each parameter is passed to the next form using hidden HTML elements.
CREATE OR REPLACE PACKAGE multi AS
PROCEDURE page1;
PROCEDURE page2 (var1 varchar2);
PROCEDURE page3 (var1 varchar2, var2 varchar2);
PROCEDURE process (var1 varchar2, var2 varchar2, var3 varchar2);
END multi;
CREATE OR REPLACE PACKAGE BODY multi AS
PROCEDURE page1 IS
begin
htp.formOpen ('multi.page2', 'POST'),
htp.p ('Enter First Value:'),
htp.formText ('var1', 10, 10);
htp.formSubmit;
htp.formClose;
END page1;
PROCEDURE page2 (var1 VARCHAR2) IS
begin
htp.formOpen ('multi.page3', 'POST'),
htp.formHidden ('var1', var1);
htp.p ('Enter Second Value:'),
htp.formText ('var2', 10, 10);
htp.formSubmit;
htp.formClose;
END page2;
PROCEDURE page3 (var1 VARCHAR2, var2 VARCHAR2) IS
begin
htp.formOpen ('multi.process', 'POST'),
htp.formHidden ('var1', var1);
htp.formHidden ('var2', var2);
htp.p ('Enter Third Value:'),
htp.formText ('var3', 10, 10);
htp.formSubmit;
htp.formClose;
END page3;
PROCEDURE process (var1 varchar2, var2 varchar2, var3 varchar2) is
BEGIN
htp.p ('The three variables entered are...'),
htp.br;
htp.p ('1=' || var1);
htp.br;
htp.p ('2=' || var2);
htp.br;
htp.p ('3=' || var3);
END process;
END multi;
Users access the web page using the URL http://node.mycompany.com/DAD_NAME/multi.page1.
Note See Recipe 14.1 to define the DAD_NAME.
The page1
procedure within the mulit
package prompts the user for an input value, which is passed to procedure page2
as its parameter, var1
. The htp.formHidden
call in the page2
procedure produces an HTML <INPUT>
tag of type HIDDEN
. In this recipe it produces the following HTML code in the client's web browser: <INPUT TYPE="hidden" NAME="var1" VALUE="xxx">
, where xxx
is the text the user entered on the first page of this multi-part form.
The page2
procedure then accepts more user input into the form variable var2
, which is passed to page3
along with var1
collected on the first input page. The third page accepts the final user input and passes it to the process
procedure, where final processing occurs.
18.118.31.24