Reputation: 305
Since yesterday I am trying to figure out checkboxes in APEX, which should be simple, however I have failed to make even the simplest scenario work.
Here is what I did so you can tell me what I did wrong.
I have three tables:
create table semester(
id number not null,
name varchar2(30) not null,
primary key(id)
);
create table subject(
id number not null,
name varchar2(30) not null,
primary key(id)
);
create table semester_subject(
id number not null,
semester_id number not null,
subject_id number not null,
primary key(id),
foreign key(semester_id) references semester(id),
foreign key(subject_id) references subject(id),
constraint semester_subject_uq unique(semester_id, subject_id)
);
I have created in apex a region with one select list with the following list of values:
select name d, id r
from semester
order by 1
and one report with the following query
select
apex_item.checkbox2(10, id, 'UNCHECKED') "id",
subject "Subject'
from subject;
Also I have one button to submit the page. What I want is to insert the ids of the subjects with the ticked checkboxes, in the semester_subject table, together with the id of the semester selected from the select list.
So I made this on submit process:
DECLARE
v_subject_id subject.id%type;
v_semester_id semester.id%type;
BEGIN
v_semster_id := :PX_SEMESTER;
FOR I in 1..APEX_APPLICATION.G_F10.COUNT LOOP
v_subject_id := APEX_APPLICATION.G_F10(i);
insert into semester_subject(semester_id, subject_id)
values(v_semester_id, v_subject_id); --I have a sequence and a trigger for the id
END LOOP;
END;
On my VPS when I submit the page I get 404 The requested URL /apex/wwv_flow.accept was not found on this server. So I created a workspace on apex.oracle.com and there the page reloads and I get no error, but when I check the table, the data isn't inserted.
Thanks in advance for any help.
Upvotes: 1
Views: 2630
Reputation: 305
OK, I figured out what I was doing wrong. The report from my sql query, rendered the id column as escaped html, instead of a checkbox by default. So I went to the report attributes and set the id column to display as simple checkbox, but this was what was messing the values. When I set the id column as standard column, everything works properly.
Upvotes: 1