Hello, I'm trying to create a dynamic action that changes a value in a data base table between 2 options.
I have 2 pages where I need this function, an interactive report and a map. I created the function no problem on the interactive report, it works fine . I then copied it over to the map but it's not working there for some reason and I cannot figure out why. Any help would be appreciated!
I am using the browser based Oracle Apex and basically followed this tutorial for the interactive report: https://www.pythian.com/blog/technical-track/apex-interactive-report-a-link-column-with-a-clickable-icon
I want to have the button to update the database in the info window of the various map objects so I put this in the HTML:
<div style="text-align: right; margin-bottom: 10px;">
<a href="javascript:void(null);" class="change-status" data-id="&OBJEKTUM_ID;" style="text-decoration: none;">
<div style="
display: inline-block;
background-color: magenta;
border-radius: 50%;
width: 25px;
height: 25px;
cursor: pointer;">
</div>
</a>
</div>
I recreated the steps from the interactive report, the button itself works because it at least triggers the “Submit Page” part of the dynamic actions but the value related to the object does not change.
The dynamic action itself can be seen on the link but I'll put it here too:
Event: Click
Selection Type: jQuery Selector
jQuery Selector: .change-status
Action 1: Set Value
Set Type: JavaScript Expression
JavaScript Expression:
$(this.triggeringElement).parent().data('id')
Action 2: Execute Server-side Code
PL/SQL Code:
UPDATE OBJEKTUMOK_BEJELENTO
SET BEJELENTO = CASE WHEN BEJELENTO = 'Y' THEN 'N' ELSE 'Y' END
WHERE OBJEKTUM_ID = :P2_ID;
Items to Submit: P2_ID
Action 3: Submit Page