This section describes how to create and use shortcuts.
Using shortcuts enables you to avoid repetitive coding of HTML or PL/SQL functions. You can use a shortcut to define a page control such as a button, HTML text, a PL/SQL procedure, or HTML. Once defined, you can invoke a shortcut using specific syntax unique to the location in which the shortcut is used. Shortcuts can be referenced many times, thus reducing code redundancy.
You can use shortcut within the following locations:
The Region Source attribute of regions defined as HTML Text (with shortcuts). See "About Regions."
Region Header and Footer Text attribute. See "Specifying a Region Header and Footer."
Item Label attributes, Pre Element Text, Post Element Text, and Default Value attribute.
Region Templates attributes. See "Creating Custom Themes."
This section describes the types of shorcut supported by Oracle Application Express.
When you create a shortcut you select a shortcut type. Oracle Application Express supports the following types of shortcuts:
Use this type of shortcut to reference a shortcut inside of a JavaScript literal string. This shortcut defines a text string. When the shortcut is referenced, it escapes the single quotation marks required for JavaScript.
Use this type of shortcut to reference a translatable message at runtime. Since this shortcut does not have a shortcut body, the name of the shortcut must match the corresponding message name. At runtime, the name of the shortcut expands to the text of the translatable message for the current language.
Use this type of shortcut to reference a shortcut inside of JavaScript literal string and reference a translatable message at runtime.
Before you can incorporate a shortcut in your application, you must define it and add it to the Shortcuts repository. This section describes how to define and reference a shortcut.
To define a shortcut:
Navigate to the Shared Components page:
On the Workspace home page, click Application Builder.
Select an application.
On the Application home page, click Shared Components.
The Shared Components page appears.
Under Other Components, select Shortcuts.
Click Create.
For Create Shortcut, select From Scratch and click Next.
On Shortcut Attributes:
Name - Enter the name by which the shortcut will be referenced.
Type - Select a shortcut type. Options include:
Shortcut - Enter the text of the shortcut. The shortcut must be less then 30,000 characters in length.
Error Text - Enter the text to display if an error should occur during the processing of a shortcut.
Build Option - Select a build option for this component.
Click Create.
New shortcuts are added to the Shortcuts page (also referred to as the Shortcut repository).
To copy an existing shortcut:
Navigate to the Shared Components page:
On the Workspace home page, click Application Builder.
Select an application.
On the Application home page, click Shared Components.
The Shared Components page appears.
Under Other Components, select Shortcuts.
Click Create.
For Create Shortcut, select As a Copy of an Existing Shortcut and click Next.
On Copy From Application, Select the application you want to copy shortcuts from and click Next.
On New Shortcuts:
Click Copy Shortcut.
To Name - Enter the new name of the shortcut to be copied.
Copy - Select Yes, No, or Copy and Subscribe.
Click Copy Shortcut.
New shortcuts are added to the Shortcuts page (also referred to as the Shortcut repository).
Once you create a shortcut, you can alter it by editing attributes on the Edit Shortcut page.
To edit an existing shortcut:
Navigate to the Shared Components page:
On the Workspace home page, click Application Builder.
Select an application.
On the Application home page, click Shared Components.
The Shared Components page appears.
Under Other Components, select Shortcuts.
Select a shortcut.
The Edit Shortcut page appears.
Edit the attributes.
To learn more about an attribute, see field-level Help. See "Viewing Field-Level Help."
Click Apply Changes.
To access shortcut reports:
Navigate to the Shared Components page:
On the Workspace home page, click Application Builder.
Select an application.
On the Application home page, click Shared Components.
The Shared Components page appears.
Under Other Components, select Shortcuts.
Click one of the following tabs:
Subscription - Displays the Subscribed Shortcuts page which displays all subscribed shortcuts in your application.
History - Display the Shortcut History page which displays a history of recently changed shortcuts by date.
Note:
The Subscription and History tabs only appear after you create a shortcut.