I have a checkbox item on my page (note: this is not inside a report) and I want to dynamically check the checkboxes when the page loads. I have a table which has all the checkbox types and a table which identifies which checkboxes that user has access to or in better terms should be checked.

My question is, within an Apex checkbox item how do you tell it to dynamically check a checkbox. I have it working in a report and my query looks like this:

SELECT at.name AS TITLE,
CASE
WHEN at.name IN (SELECT atp.name FROM preferences p) THEN apex_item.checkbox(1,at.value,'CHECKED')
ELSE apex_item.checkbox(1,at.value, 'UNCHECKED')
END AS CHECKBOX
FROM access_types at

You can use a little bit of javascript to check a checkbox.
–
AnnjawnOct 16 '12 at 13:34

@Annjawn, javascript would be an option but I need to reference my preferences table to see which checkbox should be checked. How can I do that using javascript?
–
mediumOct 16 '12 at 13:37

A simple solution could be to have hidden fields and populate the fields with the preference table values. Once the hidden fields have the values, the javascript can easily read the field and based on the value of the field check the checkbox.
–
AnnjawnOct 16 '12 at 13:41

@Annjawn, thank you. This would work. It just seems weird that you can not precheck a checkbox on a checkbox item list. It seems like that is something that would be important to web developers in oracle apex
–
mediumOct 16 '12 at 14:20

Note: I use checkboxes in reports too, but I noticed that when you have a lot of rows, it is very slower than using simple HTML checkboxes, so if you think your report is slow, I suggest you to generate simple HTML checkboxes from your query :