Oracle Apex: Creating a clickable icon

 Requirement

You would like to create an icon which links to another page in your application - which in turn could quite easily do other things like execute a procedure to download a file etc.


Solution

Create a region of type static content. In the source text, put something like the following.



<table>
<tr>

<td style="width: 100px;" align="middle" onClick="document.location.href='f?p=100:863:&APP_SESSION.:::2::';">
<section style="text-align: center; height: 90px; margin-right: 6px; padding: 5px; background-color:#004A60; overflow: hidden;">
  <div style="position: relative; top: 50%; -webkit-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); color: #FFFFFF; font-size:10pt;">
    <div>
      <span style="font-family:helvetica,arial,sans-serif; font-weight:bold; font-size: 3.8em;">?</span>
    </div>
    Click to download
  </div>
</section>
</td>

</tr>
</table>

You can play around with the look as much as you like, but the important line is this


onClick="document.location.href='f?p=100:863:&APP_SESSION.:::2::';">

On click, this will send the user to page 863 within this application (ID 100).

Result


Acknowledgement

Ted Struik for the icon and table https://tedstruik-oracle.nl/ords/f?p=25384:1010::::::
Jonysuise on this forum for the click event https://stackoverflow.com/questions/19326426/making-a-td-clickable



Comments