Re: (Webserver3.0) Copying the HTML.Form field value into a oracle variable.

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: 1999/03/02
Message-ID: <36dd2144.25455733_at_inet16.us.oracle.com>#1/1


On Mon, 01 Mar 1999 22:57:20 GMT, "ad" <aravind.doma_at_cwusa.com> wrote:

>Oracle Guru's,
>Here's one for you.
>
>Is there a way to copy a HTML.FORM field value into a oracle variable? and
>Is it possible to access a oracle variable from a javascript?
>
>Procedure X Is
>tName Varchar2(50);
>
>Begin
>htp.prn('
><HTML>
><HEAD>
><SCRIPT LANGUAGE="JavaScript"
>function ftest()
>{
>Can i access tName here? If so how?
>}
>
></SCRIPT>
></HEAD>
><BODY>
><FORM ......>
><INPUT TYPE="TEXT" NAME="Name">
>');
>//Is it possible to access the value from the above input field (Name) into
>the
>oracle variable tName decalred above? If so how?
>htp.prn('
></FORM>
></BODY>
>');
>End;

I think what you want is two procedures. One that will draw the page and one that will accept the posting of the HTML form.

eg.

create or replace
procedure draw_page as
  l_tname varchar2(50);
begin

  htp.htmlOpen;
  htp.headOpen;
  htp.p( '<script language="JavaScript">' );
  htp.p( 'function ftest()' );
  htp.p( '{' );
  htp.p( '  var javaScriptVariable = ' || l_tname );
  htp.p( ' // do more stuff' );
  htp.p( '}' );
  htp.p( '</script>' );
  htp.headClose;
  htp.bodyOpen;
  htp.formOpen( 'accept_posting' );
    htp.p( 'What is your name?' );

    htp.formText( 'p_name' );
    htp.formSubmit;
  htp.formClose;
  htp.bodyClose;
  htp.htmlClose;

end draw_page;
/

Now we need a procedure that will accept the the submit of that HTML form( accept_posting ). Its name must the url of the form and its inputs must match the names of the HTML form items ( p_name ).

procedure accept_posting( p_name varchar2 ) is begin
  htp.p( 'Hi ' || p_name || ', nice to meet you.' ); end accept_posting;
/   

I hope this helps.

chris.

>
>Any help is appreciated.
>Thanks a lot in advance.
 >AD
>
>
>

--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.
----------------------------------------------------------------------------
Opinions are mine and do not necessarily reflect those of Oracle Corporation
Received on Tue Mar 02 1999 - 00:00:00 CET

Original text of this message