Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL Problem - Urgent
The checkbox returns null if it is not checked. You could assign the cvalue to
the be actual day of the week. If it is checked then that string is returned.
As an example the following package ran under the schema "frank" in a WebDB environment and attempts to illustrate one solution:
create or replace package j
is
procedure firstpage;
procedure secondpage(monday in varchar2 default null, tuesday in varchar2 default null, wednesday in varchar2 default null, thursday in varchar2 default null, friday in varchar2 default null, saturday in varchar2 default null, sunday in varchar2 default null, submit in varchar2 default null);end;
create or replace package body j
is
checked_string constant varchar2(10) := 'checked';
action_page constant varchar2(50) := 'frank.j.secondpage';
procedure firstpage
is
procedure dayprint(p_value in varchar2, p_checked in varchar2 default null) is begin htp.tablerowopen; htp.tabledata(p_value); htp.tabledata(htf.formcheckbox(p_value,p_value,p_checked)); htp.tablerowclose; end; begin htp.htmlopen; htp.bodyopen; htp.formopen(action_page); htp.tableopen; dayprint('Monday',checked_string); dayprint('Tuesday'); dayprint('Wednesday'); dayprint('Thursday'); dayprint('Friday'); dayprint('Saturday'); dayprint('Sunday'); htp.tableclose; htp.formsubmit('Submit','Submit'); htp.formclose; htp.bodyclose; htp.htmlclose;
procedure secondpage(monday in varchar2 default null, tuesday in varchar2 default null, wednesday in varchar2 default null, thursday in varchar2 default null, friday in varchar2 default null, saturday in varchar2 default null, sunday in varchar2 default null, submit in varchar2 default null) is procedure youchose (p_when in varchar2) is begin htp.p('You selected ' || p_when || htf.br); end; begin htp.htmlopen; htp.bodyopen; if monday is not null then youchose(monday); end if; if tuesday is not null then youchose(tuesday); end if; if wednesday is not null then youchose(wednesday); end if; if thursday is not null then youchose(thursday); end if; if friday is not null then youchose(friday); end if; if saturday is not null then youchose(saturday); end if; if sunday is not null then youchose(sunday); end if; htp.bodyclose; htp.htmlclose;
Jason Ekamper wrote:
> Having a bit of a problem with the following code. This is a checkbox for
> passing whether a resource is availible on monday or not.
>
> DECLARE BLOCK
> MON varchar2(4):='';
>
> BEGIN BLOCK
> htp.tablerowopen;
> htp.tabledata('Monday', cattributes => ' width="77%"');
> htp.tabledata(htf.formcheckbox('MON', cvalue => '', cchecked => MON),
> calign => 'left');
> htp.tablerowclose;
> htp.tableclose;
>
> PROBLEM DESCRIPTION
> Mon is then passed to another procedure. If user select monday, no problems.
> If the user doesn't select monday, then the procedure fails. Overloading not
> a problem, but there is 7 variables like this (Mon - Sun). I have tried an
> array etc but no luck.
>
> Is there any way to set the value of the checkbox to 'N' if the user does
> not select it, and set it to 'Y' if the user does select it?
>
> Any help much appreciated. Thanks
>
> Jason Ekamper
> Jasek_at_bigpond.com
Received on Mon Sep 27 1999 - 23:50:12 CDT
![]() |
![]() |