Go to primary content
Oracle® Application Express Application Builder User's Guide
Release 5.0
E39147-04
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

18.8 Using Shortcuts

This section describes how to create and use shortcuts.

18.8.1 What is a Shortcut?

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:

18.8.2 Understanding Shortcut Types

This section describes the types of shorcut supported by Oracle Application Express.

18.8.2.1 Supported Shortcut Types

When you create a shortcut you select a shortcut type. Oracle Application Express supports the following types of shortcuts:

  • 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

18.8.2.2 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.

18.8.2.3 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.

18.8.2.4 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.

18.8.3 Defining and Referencing Shortcuts

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.

18.8.3.1 Defining a Shortcut from Scratch

To define a shortcut:

  1. Navigate to the Shared Components page:

    1. On the Workspace home page, click Application Builder.

    2. Select an application.

    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Other Components, select Shortcuts.

  3. Click Create.

  4. For Create Shortcut, select From Scratch and click Next.

  5. On Shortcut Attributes:

    1. Name - Enter the name by which the shortcut will be referenced.

    2. Type - Select a shortcut type. Options 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

    3. Shortcut - Enter the text of the shortcut. The shortcut must be less then 30,000 characters in length.

    4. Error Text - Enter the text to display if an error should occur during the processing of a shortcut.

    5. Build Option - Select a build option for this component.

  6. Click Create.

    New shortcuts are added to the Shortcuts page (also referred to as the Shortcut repository).

18.8.3.2 Copying an Existing Shortcuts

To copy an existing shortcut:

  1. Navigate to the Shared Components page:

    1. On the Workspace home page, click Application Builder.

    2. Select an application.

    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Other Components, select Shortcuts.

  3. Click Create.

  4. For Create Shortcut, select As a Copy of an Existing Shortcut and click Next.

  5. On Copy From Application, Select the application you want to copy shortcuts from and click Next.

  6. On New Shortcuts:

  7. Click Copy Shortcut.

    1. To Name - Enter the new name of the shortcut to be copied.

    2. Copy - Select Yes, No, or Copy and Subscribe.

    3. Click Copy Shortcut.

    New shortcuts are added to the Shortcuts page (also referred to as the Shortcut repository).

18.8.3.3 Referencing a Shortcut

You reference shortcuts using the following syntax:

"MY_SHORTCUT"

The shortcut name must be capitalized and enclosed in quotation marks.

18.8.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:

  1. Navigate to the Shared Components page:

    1. On the Workspace home page, click Application Builder.

    2. Select an application.

    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Other Components, select Shortcuts.

  3. Select a shortcut.

    The Edit Shortcut page appears.

  4. Edit the attributes.

    To learn more about an attribute, see field-level Help. See "Viewing Field-Level Help."

  5. Click Apply Changes.

18.8.5 Accessing Shortcut Reports

To access shortcut reports:

  1. Navigate to the Shared Components page:

    1. On the Workspace home page, click Application Builder.

    2. Select an application.

    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Other Components, select Shortcuts.

  3. 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.