This is a tentative (and hopefully definitive) cross reference chart telling you at a glance if you can use a certain substitution string inside a given template definition and it is supposed to apply to APEX 3.0, although most of these definitions should work on older versions.
Template substitutions are defined as #UPPERCASE_TEXT# strings, however there are a number of useful substitution strings that can be used inside templates and must be specified in the alternate format delimited by & and . (period), like &BROWSER_LANGUAGE., &SESSION. or any user-specified global substitution strings stored in the Application Definition.
Please note that using uppercase is mandatory.
While compiling this chart i found a few mistakes and omissions in the online help of Apex 3.0.
For instance in the report template section of the help guide #ALIGN# is mentioned but the real substitution string, as you can see in some of the built-in templates is #ALIGNMENT#.
The same happens with #ROW_NUM#, whose real counterpart is #ROWNUM#.
It took also some time to test hierarchical lists and calendar templates that are almost undocumented.
Concerning calendar templates i had to introduce the yellow color as you can see at the bottom of the table, because a calendar template is made up of an awful number of subtemplates and certainly there can be one or two where the substitution doesn't work but also where it makes little sense to use it.
May be that in version 2.0 i come up with a fine-grained calendar cross reference chart, but don't expect this to happen any time soon ;-)
Updates:
2009/03/27: #COLUMN_HEADER_NAME# can be used inside any of the "Column Template n" attributes in the report template page.
2012/12/20: #COLUMN_WIDTH# added, available since APEX 4.0.
2013/06/12: changed #APP_VERSION# map, removed support from Page Body Template.
Welcome to Flavio Casetta's official Oracle database application development related blog.
Showing posts with label Button Templates. Show all posts
Showing posts with label Button Templates. Show all posts
Thursday, July 26, 2007
Thursday, January 18, 2007
Forcing apex item buttons to do what you want
If you tried with little success to attach some javascript code to an Apex item button (not a region button, that's a piece of cake...) , it may console you to know that i have been in the same situation for some time.
I wanted to catch button clicks and display one of those classic, annoying pop up messages asking "do you really really really want to delete this stuff?"
With a normal region button it's pretty easy, although it's not so straightforward.
You need to go to the button property called optional URL redirect and pick the value URL and put something like:
in the URL target attribute.
Unfortunately item buttons don't come with the same feature, so one starts wondering about some fancy way of hacking the system.
Luckily enough, if you opt for a template based button, there is a property called Attributes where apparently you can put your stuff.
But this is just the half of the moon.
Because the button template you are using might not include a #BUTTON_ATTRIBUTES# substitution string in its definition (as suggested in Apex on-line help), so, whatever you put there, it won't work because it will be left out.
So, to get to the other side of the moon, you need to customize the template button, or better, to make a copy of an existing one and customize the duplicate, just in case you don't want to mess up the entire application.
Here is how i did it:
first i picked the Button, Alternative 2 template (may be it doesn't exist such template in the theme you're currently using, so pick a different one) and copied it, using the built-in copy feature.
With much fantasy i renamed it to Button, Alternative 2, Custom.
Here is the template before i started hacking it:
As you see there was no trace of the #BUTTON_ATTRIBUTES# mentioned above, so i changed it as follows:
This template will work well provided you perform the following settings in the button definition:
Happy scripting.
I wanted to catch button clicks and display one of those classic, annoying pop up messages asking "do you really really really want to delete this stuff?"
With a normal region button it's pretty easy, although it's not so straightforward.
You need to go to the button property called optional URL redirect and pick the value URL and put something like:
javascript:confirmDelete('Press OK to delete the selected rows',
'MULTI_ROW_DELETE');in the URL target attribute.
Unfortunately item buttons don't come with the same feature, so one starts wondering about some fancy way of hacking the system.
Luckily enough, if you opt for a template based button, there is a property called Attributes where apparently you can put your stuff.
But this is just the half of the moon.
Because the button template you are using might not include a #BUTTON_ATTRIBUTES# substitution string in its definition (as suggested in Apex on-line help), so, whatever you put there, it won't work because it will be left out.
So, to get to the other side of the moon, you need to customize the template button, or better, to make a copy of an existing one and customize the duplicate, just in case you don't want to mess up the entire application.
Here is how i did it:
first i picked the Button, Alternative 2 template (may be it doesn't exist such template in the theme you're currently using, so pick a different one) and copied it, using the built-in copy feature.
With much fantasy i renamed it to Button, Alternative 2, Custom.
Here is the template before i started hacking it:
<table class="t1ButtonAlternative2"
cellspacing="0" cellpadding="0"
border="0" summary="">
<tr>
<td class="t1L">
<a href="#LINK#">
<img src="#IMAGE_PREFIX#themes/theme_1/button_alt2_left.gif"
alt="" width="11" height="20" />
</a>
</td>
<td class="t1C">
<a href="#LINK#">#LABEL#</a>
</td>
<td class="t1R">
<a href="#LINK#">
<img src="#IMAGE_PREFIX#themes/theme_1/button_alt2_right.gif"
width="11" height="20" alt="" />
</a>
</td>
</tr>
</table>
As you see there was no trace of the #BUTTON_ATTRIBUTES# mentioned above, so i changed it as follows:
<table class="t1ButtonAlternative2"
cellspacing="0" cellpadding="0"
border="0" summary="">
<tr>
<td class="t1L">
<a href="#BUTTON_ATTRIBUTES#">
<img src="#IMAGE_PREFIX#themes/theme_1/button_alt2_left.gif"
alt="" width="11" height="20" />
</a>
</td>
<td class="t1C">
<a href="#BUTTON_ATTRIBUTES#">#LABEL#</a>
</td>
<td class="t1R">
<a href="#BUTTON_ATTRIBUTES#">
<img src="#IMAGE_PREFIX#themes/theme_1/button_alt2_right.gif"
width="11" height="20" alt="" />
</a>
</td>
</tr>
</table>
This template will work well provided you perform the following settings in the button definition:
- Pick Template based button as Style attribute
- Pick Button, Alternative 2 Custom (or whatever is in your case) as Template attribute
- Put the following text in the Attributes property
javascript:confirmDelete('message to user','request string '); - Clear the content of the property Button Request Value
- Set the property Button Request Source Type to Always null
Happy scripting.
Subscribe to:
Posts (Atom)
yes you can!
Two great ways to help us out with a minimal effort.
Click on the Google Plus +1 button above or...
We appreciate your support!