oracle-apexoracle-apex-5.1

Call a modal window from a dynamic action on change select list


Environment: Oracle APEX v5.1.2 / Oracle 12c R2

I have an Interactive Grid report by where one of my columns (Active) is a select list column based on an LOV, which has the values of 'Y' or 'N'.

What I am attempting to do is call a modal window from within a Dynamic Action when the value of the select list is 'Y'. I have tried the below code:

On the Active column, I have a DA that has a when event of change and a client-side condition of item/column = value (ACTIVE = Y)

I then have a TRUE condition of: Execute PL/SQL

DECLARE  
    l_url varchar2(2000);  
    l_app number := v('APP_ID');  
    l_session number := v('APP_SESSION');  
BEGIN  
    l_url := APEX_UTIL.PREPARE_URL(  
        p_url => 'f?p=' || l_app || ':22:'||l_session||'::NO:22::',  
        p_triggering_element => '$("#is-active")'  
        );  
END;  

The is-active is my static id against the ACTIVE column within my IG. Unfortunately my modal form on page 22 does not fire/appear.


Solution

  • I have found a solution, you need to create a hidden page item for example (P2_URL) and set the default value type to PLSQL Expression and then in the plsql expression write the follwing plsql:

    apex_util.prepare_url('f?p=&APP_ID.:4:&SESSION.::&DEBUG.::::', p_triggering_element => '$(''#is-active'')')
    

    then in your dynamic action instead of executing a plsql you have to execute the follwoing javascript code:

    eval($('#P2_URL').val())
    

    for more details read this articel