Home » SQL & PL/SQL » SQL & PL/SQL » Parsing two values from a select list to another page.
Parsing two values from a select list to another page. [message #46567] Tue, 15 June 2004 02:50 Go to next message
Mel
Messages: 4
Registered: May 2004
Junior Member
I am developing Portlet pages I have a select list made up of two values returned from a PL/SQL cursor.

How can I get the form to send both of the two values from a Select drop down box to another page?

So far I have the following on one page:

htp.formopen(p_back_url, cattributes =>'name=FindAESRecordForm ID=FindAESRecordForm onsubmit="return validateForm(FindAESRecordForm)"');
htp.formhidden('psubmit','S');
htp.p('
');
htp.p('
');
htp.p(' - Please select the Event you wish to edit:
-
');
htp.p('
');
htp.p(' - cE PUID: - ');
htp.p(' - ');
htp.formSelectOpen('p_cE_PUID&p_cA_PUID');
for s in SelecRecFrEditCur loop
htp.formSelectOption(s.cE_PUID ||' - '|| s.cA_PUID, cattributes=>'value=' ||s.cE_PUID||'&'||s.cA_PUID);
END LOOP;
htp.formSelectClose;
htp.p('<INPUT TYPE="IMAGE" SRC="/images/Submit.gif" value=Submit ALT="Search" BORDER="0" align="Right"> - ');
htp.p('
');
htp.p('
</CENTER>');
htp.formclose;
CLOSE SelecRecFrEditCur;

It displays the cursor values from the DB within the select list but doesn't pass them to the next page like it should.
The next page will be using p_cE_PUID and p_cA_PUID as part of the next query on the database.

Can anyone help please? We don't have HTML_DB so I don't have that option.

I'm at my wits end!
Re: Parsing two values from a select list to another page. [message #46579 is a reply to message #46567] Tue, 15 June 2004 16:25 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
point your browser to demo_pkg.testing
CREATE OR REPLACE PACKAGE demo_pkg
AS
   -- Array - not pl/sql table
   TYPE array_typ IS TABLE OF VARCHAR2 (4000);

   -- pl/sql table - not array
   TYPE pltab_typ IS TABLE OF VARCHAR2 (4000)
      INDEX BY BINARY_INTEGER;

   emptypltab   pltab_typ;

 ----------------------------------------------------------
-- spreadsheet type update (multiple row updates)
 ----------------------------------------------------------
-- the form
   PROCEDURE show_data (p_rows IN NUMBER DEFAULT 3);

--    -- the submit for the from
--    -- Seems WEB forms don't like vArrays - only PL/SQL tables
--    PROCEDURE do_something (
--       p_old_deptno   IN   array_typ,
--       p_new_deptno   IN   array_typ,
--       p_old_dname    IN   array_typ,
--       p_new_dname    IN   array_typ,
--       p_rows         IN   NUMBER DEFAULT 2
--    );

   -- the submit for the form
   PROCEDURE do_something (
      p_old_deptno   IN   pltab_typ,
      p_new_deptno   IN   pltab_typ,
      p_old_dname    IN   pltab_typ,
      p_new_dname    IN   pltab_typ,
      p_rows         IN   NUMBER DEFAULT 2
   );

 ----------------------------------------------------------
-- show multiple from features(checkbox, radio button, multi select)
 ----------------------------------------------------------
   PROCEDURE my_form;

   -- the submit for the form
   PROCEDURE my_form_submit (
      p_user   IN   VARCHAR2 DEFAULT NULL,
      p_pass   IN   VARCHAR2 DEFAULT NULL,
      p_ck1    IN   VARCHAR2 DEFAULT NULL,
      p_ck2    IN   VARCHAR2 DEFAULT NULL,
      p_ck3    IN   VARCHAR2 DEFAULT NULL,
      p_ck4    IN   VARCHAR2 DEFAULT NULL,
      p_rd1    IN   pltab_typ DEFAULT emptypltab,
      p_rd2    IN   pltab_typ DEFAULT emptypltab,
      p_text   IN   VARCHAR2 DEFAULT NULL,
      loc      IN   pltab_typ DEFAULT emptypltab,
      hid1     IN   VARCHAR2
   );
END;
/

CREATE OR REPLACE PACKAGE BODY demo_pkg
AS
/*
|| AHM 06/20/03 a few web from features from other exaples.
*/
 ----------------------------------------------------------
 -- spreadsheet type update (multiple row updates)
 ----------------------------------------------------------
 -- the form
   PROCEDURE show_data (p_rows IN NUMBER DEFAULT 2)
   IS
   BEGIN
      HTP.formOpen ('demo_pkg.do_something');
         HTP.formhidden ('p_rows', p_rows);
         HTP.tableOpen;
      
            FOR x IN (SELECT HTF.escape_sc (deptno) deptno,
                             HTF.escape_sc (dname) dname
                        FROM dept
                       WHERE ROWNUM %lt;= p_rows)
            LOOP
               HTP.p ('%lt;tr%gt;%lt;td%gt;');
               HTP.formhidden ('p_old_deptno', x.deptno);
               HTP.formtext ('p_new_deptno', cvalue =%gt; x.deptno);
               HTP.p ('%lt;/td%gt;%lt;td%gt;');
               HTP.formhidden ('p_old_dname', x.dname);
               HTP.formtext ('p_new_dname', cvalue =%gt; x.dname);
               HTP.p ('%lt;/td%gt;%lt;/tr%gt;');
            END LOOP;
   
         HTP.tableClose;
         HTP.formsubmit;
      HTP.formClose;
   END;

   -- multi row update
   PROCEDURE do_something (
      p_old_deptno   IN   pltab_typ,
      p_new_deptno   IN   pltab_typ,
      p_old_dname    IN   pltab_typ,
      p_new_dname    IN   pltab_typ,
      p_rows         IN   NUMBER DEFAULT 2
   )
   IS
   BEGIN
      FOR i IN 1 .. p_old_deptno.COUNT
      LOOP
         UPDATE dept
            SET deptno = p_new_deptno (i),
                dname = p_new_dname (i)
          WHERE deptno = p_old_deptno (i) AND dname = p_old_dname (i);

         HTP.bold ('update to dept ' || p_old_deptno (i));

         IF (SQL%ROWCOUNT = 0)
         THEN
            HTP.bold (' failed, someone else changed it');
         ELSE
            HTP.bold (' succeeded...');
         END IF;

         HTP.br;
      END LOOP;

      show_data (p_rows);
   END;

 ----------------------------------------------------------
 -- show multiple form features(checkbox, radio button, multi select)
 ----------------------------------------------------------
   PROCEDURE my_form
   IS
   BEGIN
      HTP.htmlOpen;
         HTP.headOpen;
            HTP.title ('Form Demo Page');
         HTP.headClose;
         HTP.bodyOpen;
            HTP.header (1, 'Demo Form Page', 'center');
            HTP.br;
            HTP.formOpen ('demo_pkg.my_form_submit', 'post');
               HTP.p ('Username:');
               HTP.formtext ('p_user', '8', NULL, 'User');
               HTP.br;
               HTP.p ('Password:');
               HTP.formpassword ('p_pass', '8', '8');
               HTP.hr;
               HTP.p (' Multiple checkboxes can be done independently');
               HTP.br;
               HTP.formcheckbox ('p_ck1', 'Fruit', 1);
               HTP.p ('Fruit');
               HTP.br;
               HTP.formcheckbox ('p_ck2', 'Vegetable');
               HTP.p ('Vegetable');
               HTP.br;
               HTP.formcheckbox ('p_ck3', 'Meat');
               HTP.p ('Meat');
               HTP.br;
               HTP.formcheckbox ('p_ck4', 'Grain');
               HTP.p ('Grain');
               HTP.br;
               HTP.hr;
               HTP.p ('Radio buttons are connected by name, not order');
               HTP.br;
               HTP.formradio ('p_rd1', '1', 'CHECKED');
               HTP.p ('red');
               HTP.br;
               HTP.formradio ('p_rd2', '1');
               HTP.fontOpen ('RED');
                  HTP.p ('Large');
               HTP.fontClose;
               HTP.br;
               HTP.formradio ('p_rd1', '2');
               HTP.p ('BLUE');
               HTP.br;
               HTP.formradio ('p_rd2', '2');
               HTP.fontOpen ('red');
                  HTP.p ('Medium');
               HTP.fontClose;
               HTP.br;
               HTP.formradio ('p_rd1', '3');
               HTP.p ('Green');
               HTP.br;
               HTP.formradio ('p_rd2', '3');
               HTP.fontOpen ('red');
                  HTP.p ('Small');
               HTP.fontClose;
               HTP.br;
               HTP.hr;
               HTP.p ('Text Area Field');
               HTP.br;
               HTP.formtextareaopen2 ('p_text', '4', '20', NULL, 'virtual');
               HTP.p
                  ('Even if you don''t include default text you have to have a closing tag'
                  );
            HTP.formTextareaClose;
            HTP.br;
            HTP.hr;
            HTP.p
               ('Select lists can either scroll through the choices or have a drop down:'
               );
            HTP.br;
            HTP.br;
            HTP.formSelectOpen ('loc', 'Select 1', '4', cattributes =%gt; 'MULTIPLE');
               HTP.formselectoption ('San Francisco',
                                     cattributes      =%gt; 'VALUE="1-San Francisco"'
                                    );
               HTP.formselectoption ('San Jose', 1,
                                     cattributes      =%gt; 'VALUE="2-San Jose"');
               HTP.formselectoption ('San Mateo', cattributes =%gt; 'VALUE="3-San Mateo"');
               HTP.formselectoption ('Santa Cruz',
                                     cattributes      =%gt; 'VALUE="4-Santa Cruz"'
                                    );
               HTP.formselectoption ('Santa Clara',
                                     cattributes      =%gt; 'VALUE="5-Santa Clara"'
                                    );
               HTP.formselectoption ('Santa Maria',
                                     cattributes      =%gt; 'VALUE="6-Santa Maria"'
                                    );
            HTP.formSelectClose;
            HTP.hr;
            HTP.formSelectOpen ('loc', 'Select2', 1);
               HTP.formselectoption ('Downtown', cattributes =%gt; 'VALUE="1--%gt;Downtown"');
               HTP.formselectoption ('Mid-City',
                                     1,
                                     cattributes      =%gt; 'VALUE="2--%gt;Mid-City"'
                                    );
               HTP.formselectoption ('Coast', cattributes =%gt; 'VALUE="3--%gt;Coast"');
               HTP.formselectoption ('Burbs', cattributes =%gt; 'VALUE="4--%gt;Burbs"');
            HTP.formSelectClose;
            HTP.hr;
            HTP.formhidden ('hid1', 'Hidden but not unviewable');
            HTP.formsubmit (NULL, 'Send it in!');
            HTP.br;
            HTP.formreset ('TRY AGAIN!');
         HTP.formClose;
      HTP.bodyClose;
      HTP.htmlClose;
   END;

   PROCEDURE my_form_submit (
      p_user   IN   VARCHAR2 DEFAULT NULL,
      p_pass   IN   VARCHAR2 DEFAULT NULL,
      p_ck1    IN   VARCHAR2 DEFAULT NULL,
      p_ck2    IN   VARCHAR2 DEFAULT NULL,
      p_ck3    IN   VARCHAR2 DEFAULT NULL,
      p_ck4    IN   VARCHAR2 DEFAULT NULL,
      p_rd1    IN   pltab_typ DEFAULT emptypltab,
      p_rd2    IN   pltab_typ DEFAULT emptypltab,
      p_text   IN   VARCHAR2 DEFAULT NULL,
      loc      IN   pltab_typ DEFAULT emptypltab,
      hid1     IN   VARCHAR2
   )
   IS
   BEGIN
      HTP.p ('%lt;pre%gt;');
      HTP.p ('p_user=' || p_user);
      HTP.p ('p_pass=' || p_pass);
      HTP.p ('p_ck1=' || p_ck1);
      HTP.p ('p_ck2=' || p_ck2);
      HTP.p ('p_ck3=' || p_ck3);
      HTP.p ('p_ck4=' || p_ck4);

      FOR i IN 1 .. p_rd1.COUNT
      LOOP
         HTP.p ('p_rd1=' || p_rd1 (i));
      END LOOP;

      FOR i IN 1 .. p_rd2.COUNT
      LOOP
         HTP.p ('p_rd2=' || p_rd2 (i));
      END LOOP;

      HTP.p ('p_text=' || p_text);

      FOR i IN 1 .. loc.COUNT
      LOOP
         HTP.PRINT (loc (i));
      END LOOP;

      HTP.p ('hid1=' || hid1);
      HTP.p ('%lt;/pre%gt;');
   END;
END;
/

Re: Parsing two values from a select list to another page. [message #46581 is a reply to message #46579] Tue, 15 June 2004 16:50 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Whoops - all the "%lt;" were supposed to be "<" and "%gt;" should be ">"
Re: Parsing two values from a select list to another page. [message #46587 is a reply to message #46579] Wed, 16 June 2004 00:19 Go to previous messageGo to next message
Mel
Messages: 4
Registered: May 2004
Junior Member
Hi Andrew,

Thanks for your help. Only problem is, since I'm new to PL/SQL and Portlet programming, I'm not quite sure how that would all fit in with a Portlet.
I can't learn from your example until I have it working.

Here is what I have done so far:

The PKG:
CREATE OR REPLACE PACKAGE demo_pkg
AS  
    function get_portlet_info
    (
         p_provider_id in integer
        ,p_language in varchar2
    )
    return wwpro_api_provider.portlet_record;

    function is_runnable
    (
         p_provider_id in integer
        ,p_reference_path in varchar2
    )
    return boolean;

    procedure register
    (
        p_portlet_instance in wwpro_api_provider.portlet_instance_record
    );

    procedure deregister
    (
        p_portlet_instance in wwpro_api_provider.portlet_instance_record
    );

    procedure show
    (
        p_portlet_record        wwpro_api_provider.portlet_runtime_record
    );

    procedure copy
    (
         p_copy_portlet_info in wwpro_api_provider.copy_portlet_record
    );

    function describe_parameters
    (
         p_provider_id in integer
        ,p_language in varchar2
    )
    return wwpro_api_provider.portlet_parameter_table;
    
-- Array - not pl/sql table   
  TYPE array_typ IS TABLE OF VARCHAR2 (4000);   
-- pl/sql table - not array   
  TYPE pltab_typ IS TABLE OF VARCHAR2 (4000) 
    INDEX BY BINARY_INTEGER;   
    emptypltab   pltab_typ; 
----------------------------------------------------------
-- spreadsheet type update (multiple row updates) 
-- the form   
  PROCEDURE show_data (p_rows IN NUMBER DEFAULT 3);
-- the submit for the from--    
-- Seems WEB forms don't like vArrays - only PL/SQL tables
--    PROCEDURE do_something (
--       p_old_deptno   IN   array_typ,
--       p_new_deptno   IN   array_typ,
--       p_old_dname    IN   array_typ,
--       p_new_dname    IN   array_typ,
--       p_rows         IN   NUMBER DEFAULT 2
--    );   
-- the submit for the form   
  PROCEDURE do_something (     
  p_old_deptno   IN   pltab_typ,      
  p_new_deptno   IN   pltab_typ,      
  p_old_dname    IN   pltab_typ,      
  p_new_dname    IN   pltab_typ,      
  p_rows         IN   NUMBER DEFAULT 2   
  ); 
----------------------------------------------------------
-- show multiple from features(checkbox, radio button, multi select) 
----------------------------------------------------------   
  PROCEDURE my_form;   
-- the submit for the form   
  PROCEDURE my_form_submit (      
    p_user   IN   VARCHAR2 DEFAULT NULL,      
    p_pass   IN   VARCHAR2 DEFAULT NULL,      
    p_ck1    IN   VARCHAR2 DEFAULT NULL,      
    p_ck2    IN   VARCHAR2 DEFAULT NULL,      
    p_ck3    IN   VARCHAR2 DEFAULT NULL,      
    p_ck4    IN   VARCHAR2 DEFAULT NULL,      
    p_rd1    IN   pltab_typ DEFAULT emptypltab,      
    p_rd2    IN   pltab_typ DEFAULT emptypltab,      
    p_text   IN   VARCHAR2 DEFAULT NULL,      
    loc      IN   pltab_typ DEFAULT emptypltab,      
    hid1     IN   VARCHAR2   
    );
  END;
end demo_pkg;


The PKG Body:
CREATE OR REPLACE PACKAGE BODY "demo_pkg"
AS
function get_portlet_info
	(
	 p_provider_id in integer
	 ,p_language in varchar2
	 )
	 return wwpro_api_provider.portlet_record
	 is

	 l_portlet wwpro_api_provider.portlet_record;

 begin
        l_portlet.id := AESADM.aesadm_provider.demo_pkg;
        l_portlet.provider_id := p_provider_id;
        l_portlet.title := 'Multi-Values List Demo - Owner Mel Williams';
        l_portlet.name := 'demo_pkg';
        l_portlet.description :=
            'Multi-Values List Demo - Owner Mel Williams';
        l_portlet.timeout := null;
        l_portlet.timeout_msg := null;
        l_portlet.language := 'us';
        l_portlet.has_show_edit := true;
        l_portlet.has_show_edit_defaults := true;
        l_portlet.has_show_preview := true;
        l_portlet.content_type := wwpro_api_provider.CONTENT_TYPE_HTML;
        l_portlet.preference_store_path := null;
        l_portlet.created_on := sysdate;
        l_portlet.created_by := wwctx_api.get_user;
        l_portlet.last_updated_on := sysdate;
        l_portlet.last_updated_by := wwctx_api.get_user;

        return l_portlet;

    end get_portlet_info;

    function is_runnable
    (
         p_provider_id in integer
        ,p_reference_path in varchar2
    )
    return boolean
    is
    begin

        /*
        If p_reference_path is null the caller may be the provider
        framework (i.e. the Refresh operation of the Portlet
        Repository).
        */
        if (p_reference_path is null) then

            /*
            The following if statement is the security mechanism that
            the portlet implements.  It does not have any other semantic
            meaning.  Any portlet is expected to implement their own
            security mechanism.

            This security mechanism checks if the current user is logged
            on or just accessing the portal through the public account.
            */
            if (wwctx_api.is_logged_on) then
                return true;
            else
                return false;
            end if;
        else
        /*
        If p_reference_path is not null the caller makes this call as
        a security check against the portlet instance.
        */

            /*
            The security mechanism implemented by this portlet for portlet
            instances is null so true is returned.  Returning this value
            indicates that all users have access to this portlet instance.
            */
            return true;

        end if;

    end is_runnable;

    procedure register
    (
        p_portlet_instance in wwpro_api_provider.portlet_instance_record
    )
    is
    begin
        null;
    end register;

    procedure deregister
    (
        p_portlet_instance in wwpro_api_provider.portlet_instance_record
    )
    is
    begin
        null;
    end deregister;

    procedure show
    (
        p_portlet_record        wwpro_api_provider.portlet_runtime_record
    )
    is
      l_portlet      wwpro_api_provider.portlet_record;
       p_reference_path VARCHAR2(2000);
       p_back_url VARCHAR2 (4096);
    begin

        if (not is_runnable(
             p_provider_id      => p_portlet_record.provider_id
            ,p_reference_path   => p_portlet_record.reference_path)
        ) then
            raise wwpro_api_provider.PORTLET_SECURITY_EXCEPTION;
        end if;

        /*
        Retrieve the portlet information.
        */
        l_portlet := get_portlet_info(
             p_provider_id   =>  p_portlet_record.provider_id
            ,p_language      =>  p_portlet_record.language
            );

        if (p_portlet_record.exec_mode = wwpro_api_provider.MODE_SHOW) then

            if (p_portlet_record.has_title_region) then
                /*
                Draw the portlet header and specify what links are available
                from that header (i.e. details, customize, help, and about).
                The has_title property is set at the page region level.
                */
                wwui_api_portlet.draw_portlet_header
                (
                     p_provider_id       => p_portlet_record.provider_id
                    ,p_portlet_id        => p_portlet_record.portlet_id
                    ,p_title             => l_portlet.title
                    ,p_has_details       => false
                    ,p_has_edit          => false
                    ,p_has_help          => false
                    ,p_has_about         => false
                    ,p_referencepath     => p_portlet_record.reference_path
                    ,p_back_url          => p_portlet_record.page_url
                    ,p_is_collapsed      => p_portlet_record.is_collapsed
                    ,p_show_remove       => false
                );
            end if;

            /*
            Draw the portlet borders.
            The has_border property is set at the page region level.
            */
            wwui_api_portlet.open_portlet(p_portlet_record.has_border);

            /*
            Display the content of the portlet in the show mode.
            Use the wwui_api_portlet.portlet_text() API when
            generating the content of the portlet so that the
            output uses the portlet CSS.
            */
            p_reference_path := p_portlet_record.reference_path;
            p_back_url := p_portlet_record.page_url;
            --pView := wwpro_api_parameters.get_value ('pView',p_reference_path);
            --pUser := wwpro_api_parameters.get_value ('pUser',p_reference_path);

            if (p_portlet_record.is_collapsed) then
              Null;
            else
/*
|| AHM 06/20/03 a few web from features from other examples.
*/
----------------------------------------------------------
-- spreadsheet type update (multiple row updates)
----------------------------------------------------------
-- the form
PROCEDURE show_data (p_rows IN NUMBER DEFAULT 2)
IS
BEGIN
HTP.formOpen ('demo_pkg.do_something');
HTP.formhidden ('p_rows', p_rows);
HTP.tableOpen;

FOR x IN (SELECT HTF.escape_sc (deptno) deptno,
HTF.escape_sc (dname) dname
FROM dept
WHERE ROWNUM %lt;= p_rows)
LOOP
HTP.p ('%lt;tr%gt;%lt;td%gt;');
HTP.formhidden ('p_old_deptno', x.deptno);
HTP.formtext ('p_new_deptno', cvalue =%gt; x.deptno);
HTP.p ('%lt;/td%gt;%lt;td%gt;');
HTP.formhidden ('p_old_dname', x.dname);
HTP.formtext ('p_new_dname', cvalue =%gt; x.dname);
HTP.p ('%lt;/td%gt;%lt;/tr%gt;');
END LOOP;

HTP.tableClose;
HTP.formsubmit;
HTP.formClose;
END;

-- multi row update
PROCEDURE do_something (
p_old_deptno IN pltab_typ,
p_new_deptno IN pltab_typ,
p_old_dname IN pltab_typ,
p_new_dname IN pltab_typ,
p_rows IN NUMBER DEFAULT 2
)
IS
BEGIN
FOR i IN 1 .. p_old_deptno.COUNT
LOOP
UPDATE dept
SET deptno = p_new_deptno (i),
dname = p_new_dname (i)
WHERE deptno = p_old_deptno (i) AND dname = p_old_dname (i);

HTP.bold ('update to dept ' || p_old_deptno (i));

IF (SQL%ROWCOUNT = 0)
THEN
HTP.bold (' failed, someone else changed it');
ELSE
HTP.bold (' succeeded...');
END IF;

HTP.br;
END LOOP;

show_data (p_rows);
END;

----------------------------------------------------------
-- show multiple form features(checkbox, radio button, multi select)
----------------------------------------------------------
PROCEDURE my_form
IS
BEGIN
HTP.htmlOpen;
HTP.headOpen;
HTP.title ('Form Demo Page');
HTP.headClose;
HTP.bodyOpen;
HTP.header (1, 'Demo Form Page', 'center');
HTP.br;
HTP.formOpen ('demo_pkg.my_form_submit', 'post');
HTP.p ('Username:');
HTP.formtext ('p_user', '8', NULL, 'User');
HTP.br;
HTP.p ('Password:');
HTP.formpassword ('p_pass', '8', '8');
HTP.hr;
HTP.p ('Multiple checkboxes can be done independently');
HTP.br;
HTP.formcheckbox ('p_ck1', 'Fruit', 1);
HTP.p ('Fruit');
HTP.br;
HTP.formcheckbox ('p_ck2', 'Vegetable');
HTP.p ('Vegetable');
HTP.br;
HTP.formcheckbox ('p_ck3', 'Meat');
HTP.p ('Meat');
HTP.br;
HTP.formcheckbox ('p_ck4', 'Grain');
HTP.p ('Grain');
HTP.br;
HTP.hr;
HTP.p ('Radio buttons are connected by name, not order');
HTP.br;
HTP.formradio ('p_rd1', '1', 'CHECKED');
HTP.p ('red');
HTP.br;
HTP.formradio ('p_rd2', '1');
HTP.fontOpen ('RED');
HTP.p ('Large');
HTP.fontClose;
HTP.br;
HTP.formradio ('p_rd1', '2');
HTP.p ('BLUE');
HTP.br;
HTP.formradio ('p_rd2', '2');
HTP.fontOpen ('red');
HTP.p ('Medium');
HTP.fontClose;
HTP.br;
HTP.formradio ('p_rd1', '3');
HTP.p ('Green');
HTP.br;
HTP.formradio ('p_rd2', '3');
HTP.fontOpen ('red');
HTP.p ('Small');
HTP.fontClose;
HTP.br;
HTP.hr;
HTP.p ('Text Area Field');
HTP.br;
HTP.formtextareaopen2 ('p_text', '4', '20', NULL, 'virtual');
HTP.p('Even if you don''t include default text you have to have a closing tag');
HTP.formTextareaClose;
HTP.br;
HTP.hr;
HTP.p('Select lists can either scroll through the choices or have a drop down:');
HTP.br;
HTP.br;
HTP.formSelectOpen ('loc', 'Select 1', '4', cattributes =%gt; 'MULTIPLE');
HTP.formselectoption ('San Francisco',cattributes =%gt; 'VALUE="1-San Francisco"');
HTP.formselectoption ('San Jose', 1,cattributes =%gt; 'VALUE="2-San Jose"');
HTP.formselectoption ('San Mateo', cattributes =%gt; 'VALUE="3-San Mateo"');
HTP.formselectoption ('Santa Cruz',cattributes =%gt; 'VALUE="4-Santa Cruz"');
HTP.formselectoption ('Santa Clara',cattributes =%gt; 'VALUE="5-Santa Clara"');
HTP.formselectoption ('Santa Maria',cattributes =%gt; 'VALUE="6-Santa Maria"');
HTP.formSelectClose;
HTP.hr;
HTP.formSelectOpen ('loc', 'Select2', 1);
HTP.formselectoption ('Downtown', cattributes =%gt; 'VALUE="1--%gt;Downtown"');
HTP.formselectoption ('Mid-City',
1, cattributes =%gt; 'VALUE="2--%gt;Mid-City"');
HTP.formselectoption ('Coast', cattributes =%gt; 'VALUE="3--%gt;Coast"');
HTP.formselectoption ('Burbs', cattributes =%gt; 'VALUE="4--%gt;Burbs"');
HTP.formSelectClose;
HTP.hr;
HTP.formhidden ('hid1', 'Hidden but not unviewable');
HTP.formsubmit (NULL, 'Send it in!');
HTP.br;
HTP.formreset ('TRY AGAIN!');
HTP.formClose;
HTP.bodyClose;
HTP.htmlClose;
END;

PROCEDURE my_form_submit (
p_user IN VARCHAR2 DEFAULT NULL,
p_pass IN VARCHAR2 DEFAULT NULL,
p_ck1 IN VARCHAR2 DEFAULT NULL,
p_ck2 IN VARCHAR2 DEFAULT NULL,
p_ck3 IN VARCHAR2 DEFAULT NULL,
p_ck4 IN VARCHAR2 DEFAULT NULL,
p_rd1 IN pltab_typ DEFAULT emptypltab,
p_rd2 IN pltab_typ DEFAULT emptypltab,
p_text IN VARCHAR2 DEFAULT NULL,
loc IN pltab_typ DEFAULT emptypltab,
hid1 IN VARCHAR2
)
IS
BEGIN
HTP.p ('%lt;pre%gt;');
HTP.p ('p_user=' || p_user);
HTP.p ('p_pass=' || p_pass);
HTP.p ('p_ck1=' || p_ck1);
HTP.p ('p_ck2=' || p_ck2);
HTP.p ('p_ck3=' || p_ck3);
HTP.p ('p_ck4=' || p_ck4);

FOR i IN 1 .. p_rd1.COUNT
LOOP
HTP.p ('p_rd1=' || p_rd1 (i));
END LOOP;

FOR i IN 1 .. p_rd2.COUNT
LOOP
HTP.p ('p_rd2=' || p_rd2 (i));
END LOOP;

HTP.p ('p_text=' || p_text);

FOR i IN 1 .. loc.COUNT
LOOP
HTP.PRINT (loc (i));
END LOOP;

HTP.p ('hid1=' || hid1);
HTP.p ('%lt;/pre%gt;');
END;
END;
end if;

            if (p_portlet_record.has_border) then
                wwui_api_portlet.close_portlet;
            end if;

        elsif (p_portlet_record.exec_mode = wwpro_api_provider.MODE_SHOW_ABOUT) then
            /*
            Display the about page for the portlet.
            */
            htp.p('Portlet - Mode Show About');
        elsif (p_portlet_record.exec_mode = wwpro_api_provider.MODE_SHOW_EDIT) then
            /*
            Display the edit page for the portlet.
            */
            htp.p('Portlet - Mode Show Edit');
        elsif (p_portlet_record.exec_mode = wwpro_api_provider.MODE_SHOW_HELP) then
            /*
            Display the help page for the portlet.
            */
            htp.p('Portlet - Mode Show Help');
        elsif (p_portlet_record.exec_mode = wwpro_api_provider.MODE_SHOW_EDIT_DEFAULTS) then
            /*
            Display the edit defaults page for the portlet.
            */
            htp.p('Portlet - Mode Edit Defaults');
        elsif (p_portlet_record.exec_mode = wwpro_api_provider.MODE_SHOW_DETAILS) then
            /*
            Display the details page for the portlet.
            */
            htp.p('Portlet - Mode Show Details');
        elsif (p_portlet_record.exec_mode = wwpro_api_provider.MODE_PREVIEW) then
            /*
            Display the preview page for the portlet.
            */
            htp.p('Portlet - Mode Show Preview');
        end if;

    end show;

    procedure copy
    (
         p_copy_portlet_info in wwpro_api_provider.copy_portlet_record
    )
    is
    begin
        null;
    end copy;

    function describe_parameters
    (
         p_provider_id in integer
        ,p_language in varchar2
    )
    return wwpro_api_provider.portlet_parameter_table
    is
        l_params_tab    wwpro_api_provider.portlet_parameter_table;
    begin

        return l_params_tab;

    end describe_parameters;
    
end demo_pkg;


I have registered them within my provider and the provider is giving me this message when I compile it:
Error(248,9): PLS-00103: Encountered the symbol "GET_PORTLET_LIST" when expecting one of the following: if.
Error(489,1): PLS-00103: Encountered the symbol "END" when expecting one of the following: begin function package pragma procedure form.

When compiling the demo_pkg package and body, I get the following error message:
Error: ORA-00922: Missing or Invalid Option.

Can you help me please?
Have I put things in the wrong place?

Cheers,
Mel
Re: Parsing two values from a select list to another page. [message #46605 is a reply to message #46587] Wed, 16 June 2004 12:48 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Mel

Sorry I can't help beyong trimming the example down further. It should be possible to just create a plain DAD connecting to Oracle rather than a Portal DAD and to get that working first. The extra Portal code is just fluff.
Just replace %lt; and %gt; with < and >

CREATE OR REPLACE package demo_pkg1
as
    type myArray is table of varchar2(2000) index by binary_integer;
    empty myArray;

procedure testing( p_multi_selct   in myArray  default empty);
end;
/

CREATE OR REPLACE PACKAGE BODY demo_pkg1
AS
   PROCEDURE testing (p_multi_selct IN myarray DEFAULT empty)
   AS
   BEGIN
      HTP.p ('inputs passed in are:%lt;br%gt;');

      FOR i IN 1 .. p_multi_selct.COUNT
      LOOP
         HTP.p ('p_multi_selct(' || i || ') = ' || p_multi_selct (i) || '%lt;br%gt;');
      END LOOP;

      HTP.p ('%lt;form action=demo_pkg1.testing method=post%gt;');
      HTP.p
         ('%lt;SELECT NAME="p_multi_selct" SIZE="5" multiple%gt;
			%lt;OPTION value="A"%gt;AAA
			%lt;OPTION value="B"%gt;BBB
			%lt;OPTION value="C"%gt;CCC
			%lt;OPTION value="D"%gt;DDD
			%lt;OPTION value="E"%gt;EEE
			%lt;OPTION value="F"%gt;FFF
			%lt;OPTION value="G"%gt;GGG
			%lt;OPTION value="H"%gt;HHH
			%lt;OPTION value="I"%gt;III
			%lt;OPTION value="J"%gt;JJJ
			%lt;/SELECT%gt;');
      HTP.p ('%lt;input type=submit%gt;');
      HTP.p ('%lt;/form%gt;');
   END;
END;
/
Previous Topic: creating parametrized view by store procedure
Next Topic: Locking occurring when performing SELECT with ORDER BY
Goto Forum:
  


Current Time: Mon Dec 08 15:43:32 CST 2025