Oracle Apex - Passing values to a modal

 Problem

You have a button which calls a different modal page.

Even though you specify the target page item and source value, the modal does not receive the parameter.

Solution

Create a hidden item to store a URL. Mine is called P5_ATTACHMENT_URL

The parameter that I want to pass is P5_MESSAGE_ID.

Create a dynamic action on change of the value that you want to pass.

(If you have more than one value you will need to repeat these steps)


You want to set the value with this code, don't forget NOT to escape special characters otherwise the link will not make sense.



Here is my code. The target page is 7, target item P7_MESSAGE_ID

RETURN apex_util.prepare_url('f?p='||:APP_ID||':7:'||:APP_SESSION||'::NO::P7_MESSAGE_ID:'|| :P5_MESSAGE_ID );

Now go to your button and create dynamic click action on it.
Check that your Behaviour property on your button is "Defined by Dynamic Action"

The action is to execute Javascript, here is the code


window.location = $("#P5_ATTACHMENT_URL").val();

Your modal will now receive the value.

Acknowledgement

https://community.oracle.com/tech/developers/discussion/4015478/passing-value-to-modal-dialog-without-submitting-page
https://community.oracle.com/tech/developers/discussion/4270468/uncaught-syntaxerror-unexpected-token







Comments