Apex dynamic checkboxes
A way to display and handle checkboxes apex items by code
');
for col in chk_cur loop
if ind mod 2 > 0 then
htp.prn('
');
end;
Display check boxes from select request : Create Region with PL/SQL Type and with following source
declare cursor chk_cur is SELECT id, label FROM t_witr ORDER BY label; ind integer := 1; l_chk_selected_ids varchar2(3000) := null; l_check_state varchar2(30) := 'CHECKED'; begin l_chk_selected_ids := :P1_CHK_SELECTED_IDS; htp.prn('Items selection
'); htp.prn('
'); else htp.prn(' | '); end if; if l_chk_selected_ids is not null and length(trim(l_chk_selected_ids)) > 0 and instr(l_chk_selected_ids,'#!' || col.id || '#!') <= 0 then l_check_state := 'UNCHECKED'; else l_check_state := 'CHECKED'; end if; htp.prn(apex_item.checkbox(1,col.id,l_check_state)); htp.prn(''); if ind mod 2 > 0 then htp.prn(' | '); else htp.prn('
Create button submit, and then create process executed after submit to save items selection state like following
declare l_chk_selected_ids varchar2(3000); begin FOR i in 1..APEX_APPLICATION.G_F01.count LOOP l_chk_selected_ids := l_chk_selected_ids || '#!' || APEX_APPLICATION.G_F01(i) || '#!'; END LOOP; :P1_CHK_SELECTED_IDS := l_chk_selected_ids; end;