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: <36dbec4d.358004_at_inet16.us.oracle.com>#1/1


On Tue, 02 Mar 1999 11:21:06 +0100, Richard Hall <rjhall_at_uk.oracle.com> wrote:

Unless of course null is a valid value. :-)

I usually write two procedures to avoid such problems and to separate business logic from UI. It just makes your code more modular and easier to debug. But its personal preference.

just my $0.02

chris.

>it would be nicer to use one procedure...
>create or replace procedure myProc(name in varchar2 default null) as
>begin
> if name is null then
> ...build form...
> htp.formText(cname => 'name');
> else
> process form
>end if;
>end myProc;
>
>Christopher Beck wrote:
>
>> 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

--
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