Press "Enter" to skip to content

Oracle Apex 19.1 – Create Checkbox of Yes/No Type

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:

Oracle Apex 19.1 - Create a checkbox example.

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:

Oracle Apex computation 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: