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

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL/HTML how to question

Re: PL/SQL/HTML how to question

From: stephen O'D <stephen.odonnell_at_gmail.com>
Date: 14 Dec 2005 09:49:41 -0800
Message-ID: <1134582581.310286.196530@g14g2000cwa.googlegroups.com>


dennishancy_at_eaton.com wrote:
> I have a PL/SQL package that displays an HTML form like the following:
>
>
> name | approved?
> ------------------
> Allen | x
> -----------------
> Betty | x
> -----------------
> Chuck |
> ------------------
>
> where the "x" represent a checkbox.
>
> When the user clicks OK, I need to update the approved field in my
> table.
>
>
> So many questions about how to make this work. Hoping it's simpler
> than I am thinking it is.
>
>
> If I try to refer to the form values in the table, it only gives me
> those that have been checked. I was hoping to loop through all entries
> on the table so I can update the unapproved records too.
>
>
> Any advice on how I can accomplish this?
>
> Thanks.
>
>
> Dennis
> Eaton Corporation
> Cleveland, OH

Assuming you are not using HTMLDB, the reason you are only getting the ones you checked returned is because the html/cgi specification states that non-checked boxes are not returned to the server at all - it is frustrating at times!!

To get this to work, you will probably need to add another hidden field in the html that contains the same value as the checkbox. Then you can loop over each of the records to approve that come from the checkboxes, and then for each of the hidden fields (which could be approved or non-approved) do something like

for i in 1 .. non-approved.count loop
  approved := false;
  for j in 1 .. approved.count loop
    if non-approved(i) := approved(j) then

      approved := true;
      exit;

    end if;
  end loop;
  if not approved then
    update();
  end if;
end loop;

This is all very well if there are only 10 or 20 records - if there are 100's or 1000's it will not perform well at all.

The check box is useful when you only want to consider records that are ticked, and take no action on any other, to access the non-ticked ones too a different method could be better. Received on Wed Dec 14 2005 - 11:49:41 CST

Original text of this message

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