This Oracle Apex tutorial shows you, how to create a checkbox of Yes/No type. To demonstrate this example I am using Oracle Apex version 19.1.
Mostly, we used to create checkboxes to indicate and store flag values, such as Y/N for Yes/No, T/F for True/False, etc. Similarly, for this example, I will create a checkbox for a field ACTIVE_CUSTOMER
having data type Varchar2
size 1, to store Y if checkbox checked and to store N if unchecked.
Create Checkbox in Oracle Apex to Store Y/N for Yes/No Values
In Oracle Apex page designer, select or create a new page item for a flag field for which you want to create a checkbox. Then change the type of the item as Checkbox and set the following property settings:
- Settings > Number of Columns: 1
- List of Values > Type: Static Values
- Display Extra Values: No
- Static Values: Then click on the button for static values and add the values as shown in the below image:
Now we have specified the checkbox checked value as Y. But what if the user will uncheck the checkbox, we need to store the value N for it. To do this follow these steps:
Do the right-click on the checkbox item and select Create Computation and set the following properties:
- Point: After Submit
- Computation > PL/SQL Expression:
nvl(:P20_ACTIVE_CUSTOMER, 'N');
Below is the screenshot of the above settings:
The above PL/SQL expression will execute at the time of page submit and will assign the value N if the checkbox is unchecked means the value of page item P20_ACTIVE_CUSTOMER
is null.
Save the changes and run the page to test.
Related tutorials:
- Oracle Apex: Set Page Item Value Using PL/SQL
- Oracle Apex: Set Page Items Value Using JavaScript on the Click of a Link in Interactive Report
Hi Vinish,
that was helpful. Thanks
Thanks your guide is very clear and easy to understand
Thanks for this - very clear and helpful
I have a doubt like if we are clicking on checkbox then in reports one column few values should be visible
Please can you help me with this
Please ask your question on orclqa.com with more details.