Skip to Main Content
Feature Request FR-3890
Product Area Page Components
Status DELIVERED

3 Voters

Alternative for opening Modal Dialog page

ino.laurensse Public
· Jul 5 2024

Idea Summary
URLs to Modal Dialog pages are in the form of

href="javascript:apex.navigation.dialog()"

With this changed behaviour in 23.1, this is actually a problem:

Consciously displaying "unsafe" HTML, such as script tags or javascript: expressions, onclick attributes, etc., is no longer possible as this content is stripped away.

Basically, the URL APEX generates is not in line with this principle.

We didn't notice this changed behaviour, because in upgrades, the type is changed to:

HTML (Unsafe) [Deprecated]

The idea is to do something about it. Either allow open dialog this way, or open dialog in another way (maybe through an action?).

Use Case
We have a lot of display only items that link to a modal page. E.g. an employee name that links to the employee modal dialog page:

<a href="' || apex_page.get_url(p_page => 27, p_items => 'P27_EMPNO', p_values => '7839') || '">KING</a>

The proposed solution in the 23.1 release notes is not practical:

  • for Display Only Page Items in HTML format, use a Static Content Region

Preferred Solution (Optional)
I see several options:

Revert this change until APEX works consistently with the new HTML Sanitization policy.

“Un-deprecate” the option HTML (Unsafe) [Deprecated]

Change the URL to a modal dialog without using the javascript option.

Make an exception for opening modal pages.

Like CR/IR columns, add the attribute Escape special characters.

This has been delivered in Oracle APEX 24.2!

Comments

Comments

  • ino.laurensse OP 7 months ago

    For anyone looking for a quick hack:

    Create an action (on page load):

    apex.actions.add([
       {
         name: 'open-modal',
         label: 'Open Modal',
         action: (event, element, args) => {
           let modal = args.modal.replace("''","");
           apex.navigation.redirect(modal)
           return true;
         },
       },
     ]);
    

    Set the value of the HTML Display Only item as:

    return '<a href="#action$open-modal?modal='||apex_page.get_url(p_page => '10', p_items => 'P10_ID', p_values => :P15_ID )
          ||'">' || <some description> || '</a>';
    

    It's very ugly (and there is still the “javascript:” in the url).

    I think the APEX team can make this easier and more robust :-)