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!

Oracle APEX 23.2 - Switch Page Item Not Updating

McRiversMay 6 2024 — edited May 13 2024

I am trying to understand how APEX handles Switch page items in the DOM and how to get the current value/state of a switch page item. I have the switch set up to use values of 'Y' or 'N'.

When looking at the DOM for the sample app I created, whenever I toggle the switch to the "off" or "no" position the input value (in HTML DOM) does not seem to update from 'Y' to 'N' or vice versa. I do not see any hidden input when using the switch page item, like I do with the checkbox page item.

I created a sample page/app here to better show what I mean. If you toggle the native switch page item, the value always seems to be 'Y'. But when I submit the page (submit button), I see the correct value saved in session state, when the page is reloaded. So how is the switch value set/fetched? The DA mentioned above uses the following code:

let switchVal = $(this.triggeringElement).val();
alert(switchVal);

What am I misunderstanding? How do I get the current value of the switch item based on its toggle state? Is there a hidden input somewhere in the DOM that I am missing?

This post has been answered by McRivers on May 9 2024
Jump to Answer
Comments
Post Details
Added on May 6 2024
2 comments
674 views