Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Y/N Field Doesn't Work as Checkbox or Switch

Jared COct 16 2024

We are on APEX Product Build 21.1.5. I have a Page Item whose value is initialized by a Before Header process of type Execute Code. The code simply runs a “get” for the given record and assigns the OUT parameters to the respective page items.

The Page Item in question is initialized to the value of a database column that is of Data Type CHAR(1 BYTE), is NULLable, has a data default of NULL, and has a constraint: my_field IN ('Y', 'N').

Now here is the problem. When the Page Item is a Text Field, all is well. But when I change the Page Item to a Checkbox or Switch, the Checkbox/Switch does not reflect the value from the database (again, it does if it is a text field). For a checkbox, for instance, I would expect the Checkbox to be checked if the value is ‘Y’ and to be unchecked if the value is NULL or ‘N’. However, I have a specific example where the value is ‘Y’ but the Checkbox shows as unchecked.

For a given record where I know the database value is ‘Y’…

Here is the Item Name, Display, Item Value, Status, and Encrypted from Session State window when I have the Page Item as a Text Field:

Here is the same information when I have the Page Item as a Checkbox:

Nothing has been changed other than the Page Item type.

Does anyone know how to remedy this OR at least why this is happening? I'd much prefer to use a Checkbox or Switch if at all possible. Thank you!

This post has been answered by fac586 on Oct 21 2024
Jump to Answer
Comments
Post Details
Added on Oct 16 2024
24 comments
1,220 views