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: How do I use Checkboxes and 'Multiple' Select boxes in Web Server applications

Re: How do I use Checkboxes and 'Multiple' Select boxes in Web Server applications

From: Steve Jelfs <s.jelfs_at_btinternet.com>
Date: 1998/02/20
Message-ID: <34ED6994.5BC4@btinternet.com>#1/1

Michael Rothwell wrote:
>
> You need to make use of the pl/sql tables and then loop
> through the table in the procedure that is receiving the
> information. Always fill the first table element with a
> dummy value or else if no check boxes are checked you will
> get an error because no variable was passed. If you look at
> the BROWSE package that comes with OWS you will find an
> example of this as used to select which columns of a table
> to display in a report.
>
> Michael.
>
> gsimpson_at_liv.ac.uk wrote:
> >
> > I am writing some PL/SQL procedures that generate HTML forms that
> > submit their data to more PL/SQL procedures.
> > How do I find which checkboxes have been selected in a group? I seem to
> > be able to get the first one that has been selected, but none of the
> > others. If I call each checkbox a different name then the procedure only
> > succeeds if all the boxes are checked.
> >
> > A similar problem occurs with select lists in HTML forms. How do I find
> > which members of the list have been selected?
> >
> > Perhaps someone could send me a sample bit of code to handle this.
> >
> > Many thanks
> >
> > Gawain Simpson

Hmmm......

Well, I do it like this:

        The cursor, c_columns, bring back a number of columns from a table. The form then passes the variables to 'pkg.proc' which expects v_table VARCHAR2
data_date DATE
measure_table_id VARCHAR2
v_fault_number VARCHAR2
v_columns owa_util.ident_arr -- The list of columns derived from the check boxes.

htp.formOpen(owa_util.get_owa_service_path||'pkg.proc');

   htp.formHidden('data_date',data_date);     
   htp.formHidden('v_table', p_table_selected);
   htp.formHidden('measure_table_id',measure_table_id);  
   htp.formHidden('v_fault_number',p_fault_number);
   row:=1;
   for crec in c_columns loop
        IF row = 1 THEN
	 htp.formCheckBox('v_columns',crec.COL_NM,'CHECKED');  
        ELSE
	 htp.formCheckBox('v_columns',crec.COL_NM);
        END IF;
        htp.print(crec.COL_NM);
        htp.nl;
        row:= row + 1;

   end loop;
   htp.nl;
   htp.nl;
   htp.formSubmit(NULL, 'Submit');
   htp.hr;
   htp.formClose;

******************************************

Also, you'll notice that the first check box is checked as default, this ensures that the form will always pass at least one value obviating the need for a 'dummy' value to be passed

Sj Received on Fri Feb 20 1998 - 00:00:00 CST

Original text of this message

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