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!

How to properly use checkboxes ?

MaxwellSep 10 2021

Hi all,
I'm going to explain my situation, then how imagined the solution. The solution is not set in stone, I'm fairly new to Apex so feel free to suggest better approaches.
I want to be able to manage customers subscriptions to services. I have a table of services (products), a table of customers, and a table inbetween for subscriptions, with 2 columns to store the product and customer Ids, creating a subscription. Basic stuff.
I created a Master/details page. Where I select the product (master), the details show ALL customers, with a checkbox in the first column. If a line with the product id and the customer Id is found, the checkbox is checked, showing customers already subscribed to this product. The data is displayed in an interactive grid based on a query hitting a view, the checkbox column is created by
select APEX_ITEM.CHECKBOX2(1, id, decode(CHK, 1, 'CHECKED', NULL)) CHK,
This works.
Now, I struggle to find a way to insert/update/delete the subscription table. Since some restrictions apply, I'm calling a stored procedure to handle the subscription: some customers can not be elligible to some products, and some can not be unsubscribed (they already payed for instance). Using a dynamic action on change, I'm calling the procedure everytime I check/uncheck a box, but I can't find a way to
retieve the customer Id of the line being checked/unchecked to pass it to the procedure
retrieve the checkbox state
block the check/uncheck depending on in/out parameter corresponding to the checkbox state
Thanks a lot for taking the time to read this post !

Comments
Post Details
Added on Sep 10 2021
7 comments
2,191 views