Search code examples
oracletemplatesplsqloracle-apex

Oracle Apex Modal Dialog Link being wrongly transformed


I've got an Oracle Apex 18.1 Dialog which is via Javascript. Inside of that Modal Dialog there is a Classic Report Region, which shows a bunch of Images which have a hyperlink attached to them. The Template I use looks like this:

<a href="f?p=&APP_ID.:40:&APP_SESSION.::NO:RP:P40_VIDEOID:#VIDEOID#">
    <img src="https://img.youtube.com/vi/#VIDEOID#/mqdefault.jpg" width="210" height="118"> 
</a>

The problem is, that Apex transforms that link before the Modal Dialog gets opened into something like this:

<a href="javascript:apex.navigation.dialog.close(true,'f?p=100:40:4815510542999:::::');::NO:RP:P40_VIDEOID:vFZHArtFt8Y" class="WATCHED_VIDEO_0">
    <img src="https://img.youtube.com/vi/vFZHArtFt8Y/mqdefault.jpg" width="210" height="118"> 
</a>

And that breaks the Page, because the Javascript there is invalid - the Item Parameter is not replaced and thus the Link is not working.

What do I have to do, to get apex to include that Item Value?


Solution

  • Maybe you can create the url in your select and use then in your template. In your sql you create the URL with APEX_UTIL.PREPARE_URL and name the column as url

    SELECT
    ...,
    APEX_UTIL.PREPARE_URL(
        p_url => 'f?p=' || :APP_ALIAS || ':40:' || :APP_SESSION ||'::NO::P40_VIDEOID:' || mytable.video_id,
        p_checksum_type => 'SESSION') as url
    FROM
    mytable
    

    In your temmplate you can use the url value like you are using #VIDEOID#

    <a href="#URL#">
        <img src="https://img.youtube.com/vi/#VIDEOID#/mqdefault.jpg" width="210" height="118"> 
    </a>