Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: accessing multiple values from an html form multi-select box

Re: accessing multiple values from an html form multi-select box

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: 1998/01/15
Message-ID: <34ce1fff.215857146@inet16>#1/1

On Wed, 14 Jan 98 23:15:49 GMT, thale_at_nospam.novell.com (Todd Hale) wrote:

>If I have an html form with a SELECT box with MULTIPLE select turned on, how
>do I access these multiple items in the PL/SQL procedure that receives them?
>When I use VARCHAR2, I only see the first item. But, if I force an error page
>(wrong procedure name in the form 'action'), I can see that multiple values
>are being sent. (I have the error level bumped up on the server to help with
>debugging.)
>
>Any help would be greatly appreciated!
>
>Todd Hale --> dolthead

you pass these in via pl/sql tables (sort of like arrays). there are 2 table types supplied with the OWA packages -- owa.vc_arr is a table of varchar2(2000) and owa_util.ident_arr is a table of varchar2(30).

for you own protection however, I would suggest you create your own type and use that. for example:

create or replace package types
as

    type vcArray is table of varchar2(2000) index by binary_integer;

    empty_vcArray vcArray;
end;
/

the advantage to this is that you can default the vcArray type in your procedure now (think of what would happen if the user selects 0 items in your multi-select list, if we don't default the IN parameter -- the webserver cannot call your procedure, you can 'fix' this with hidden fields but I prefer this method)....

so, once you have this package, you can code:

create or replace procedure my_web_procedure ( ....,
  multi_list_items in types.vcArray default types.empty_vcArray,   .... )
is
begin

   for i in 1 .. 100000 loop
   begin

      htp.p( 'you picked ' || multi_list_items(i) );    exception when no_data_found then exit;    end;
   end loop;
end;
/

or in 7.3 and up:

create or replace procedure my_web_procedure ( ....,
  multi_list_items in types.vcArray default types.empty_vcArray,   .... )
is
begin

   for i in 1 .. multi_list_items.count loop

      htp.p( 'you picked ' || multi_list_items(i) );    end loop;
end;
/  

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD  

http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Thu Jan 15 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US