Jestem_z_Kozanowa
Jestem_z_Kozanowa

Reputation: 637

Conditionally display image in Oracle Apex based on procedure

I would like to display conditionally image in the region header based on output from the procedure. Procedure is returning number from 1-5. Then number needs to be 'injected' somehow to html region : <div style="width: 290px; margin: 0 auto;"><img src="#WORKSPACE_IMAGES#v(':P1_ID').png" width="290"></div>

so output of field :P1_ID will determine which name of the file to display. I am completely lost how I can pass any values on this level of the page. I could try to output whole html through procedure but I am not sure if it is the best solution towards solving this problem.Any help greatly appreciated.

Upvotes: 1

Views: 2522

Answers (1)

Jeffrey Kemp
Jeffrey Kemp

Reputation: 60262

If the item's value is determined before the regions are rendered you can do this:

<div style="width: 290px; margin: 0 auto;">
  <img src="#WORKSPACE_IMAGES#&P1_ID..png" width="290">
</div>

If the item's value can change dynamically on the page (e.g. if the value is updated by a dynamic action), you may need to write some javascript to modify the image source.

P.S. not related to your question, but the correct syntax to access the value in PL/SQL is v('P1_ID') - i.e. :P1_ID is only used where a SQL bind variable is used.

Upvotes: 2

Related Questions