16.10 Using Shortcuts
Use shortcuts to avoid repetitive coding of HTML or PL/SQL functions.
- What is a Shortcut?
Learn about shortcuts and when to use them. - Supported Shortcut Types
Oracle APEX supports six types of shortcuts. - Defining a Shortcut from Scratch
Define a shortcut on the Shortcuts page. - Editing Existing Shortcuts
Once you create a shortcut, you can alter it by editing attributes on the Edit Shortcut page. - Copying an Existing Shortcut
Copy existing shortcuts from the Shortcut repository. - Copying or Subscribing to a Shortcut
Copy a shortcuts from the current application or from another applications. When copying a shortcut from another app, you can also subscribe to it. - Subscribing to a Shortcut
Subscribe to a shortcut on the Shortcuts, Edit page. - Accessing Shortcut Reports
View the shortcut Subscription and History reports.
Parent topic: Managing Shared Components
16.10.1 What is a Shortcut?
Learn about shortcuts and when to use them.
Use a shortcut to define frequently used code once and then reference it in many places thus reducing code redundancy. For example, you can create a shortcut to define a page control such as a button, HTML text, a PL/SQL procedure, or HTML.
You can use a shortcut within the following locations:
- The Region Source attribute of regions defined as HTML Text (with shortcuts).
- Region Header and Footer Text attribute.
- Item Label attributes, Pre Element Text, Post Element Text, and Default Value attribute.
- Region Templates attributes.
Referencing a Shortcut
Once you define a shortcut, you can invoke it using specific syntax unique to the location in which the shortcut is used.
You reference shortcuts using the following syntax:
"MY_SHORTCUT"
The shortcut name must be capitalized and enclosed in quotation marks.
Parent topic: Using Shortcuts
16.10.2 Supported Shortcut Types
Oracle APEX supports six types of shortcuts.
When you create a shortcut you select a shortcut type. Supported shortcut types include:
- PL/SQL Function Body
- HTML Text
- HTML Text with Escaped Special Characters
- Image
- Text with JavaScript Escaped Single Quotes
- Message
- Message with JavaScript Escaped Special Quotes
Text with JavaScript Escaped Single Quotes
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.
Message
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.
Message with JavaScript Escaped Single Quotes
Use this type of shortcut to reference a shortcut inside of JavaScript literal string and reference a translatable message at runtime.
Parent topic: Using Shortcuts
16.10.3 Defining a Shortcut from Scratch
Define a shortcut on the Shortcuts page.
To define a shortcut:
Parent topic: Using Shortcuts
16.10.4 Editing Existing Shortcuts
Once you create a shortcut, you can alter it by editing attributes on the Edit Shortcut page.
To edit an existing shortcut:
Parent topic: Using Shortcuts
16.10.5 Copying an Existing Shortcut
Copy existing shortcuts from the Shortcut repository.
To copy an existing shortcut:
Parent topic: Using Shortcuts
16.10.6 Copying or Subscribing to a Shortcut
Copy a shortcuts from the current application or from another applications. When copying a shortcut from another app, you can also subscribe to it.
Tip:
Subscriptions enable developers to reuse shared components across several applications in a workspace. To learn more about subscriptions, see Using Shared Component Subscriptions.To copy or subscribe to a shortcut:
Parent topic: Using Shortcuts
16.10.7 Subscribing to a Shortcut
Subscribe to a shortcut on the Shortcuts, Edit page.
Subscriptions enable developers to reuse shared components across several applications in a workspace. To learn more about shared component subscriptions, see Using Shared Component Subscriptions.
Tip:
You can also subscribe to a shortcut by copying it and then subscribing. See Copying or Subscribing to a Shortcut.To subscribe to a shortcut:
Parent topic: Using Shortcuts
16.10.8 Accessing Shortcut Reports
View the shortcut Subscription and History reports.
To access shortcut reports:
Parent topic: Using Shortcuts