Oracle® HTML DB
Release 2.0
  Go To Table Of Contents
Contents

Previous
Previous
Next
Next
 

Creating Buttons

As you design your application, you can use buttons to direct users to a specific page or URL, or to post or process information (for example, by creating Create, Cancel, Next, Previous, or Delete buttons).

Buttons can perform two different types of actions. A button can submit a page and then redirect to a URL. Alternately, a button can branch to a URL without submitting the page.

Topics:

Creating a Button Using a Wizard

You create a button by running the Create Button Wizard from the Page Definition. Each button resides in a region. A region is an area on a page that serves as a container for content.

To create a new button:

  1. Navigate to the appropriate Page Definition:

    1. Navigate to the Workspace home page.

    2. Click the Application Builder icon.

    3. Select an application.

    4. Select a page.

      The Page Definition appears.

  2. If necessary, create an HTML region. See "Customizing Regions".

  3. Under Buttons, click the Create icon.

    The Create Button Wizard appears.

  4. Select a region to contain the button.

  5. Select a position for the button:

    • Create a button displayed among this region's items

    • Create a button in a region position

    Select Create a button displayed among this region's items to add a button to a region as if it was an item (for example, to add a button directly to the right of a form field).

  6. If you select Create a button in a region position:

    1. Specify the Button Name and Label.

    2. Select a Button Type: HTML Button (Default), Image, or Template Driven

      Select Button is Reset to create an Undo button. When enabled, this type of button resets the page values to the state they were in when the page was initially rendered.

    3. Select an Action.

      Selecting Submit page and redirect to URL submits the current page to the HTML DB engine whenever a user clicks the button.

      Selecting Redirect to URL without submitting page avoids submitting the page. Choose this action when submitting the page for processing is not necessary (for example, a Cancel button). This action avoids processing in the database and therefore reduces the load.

  7. If you select Create a button displayed among this region's items:

    1. Specify the Button Name and Sequence.

    2. Specify if the button displays at the beginning of a new line or new field.

    3. Specify a Label.

    4. Enter the value of Request.

    5. Select the Button Style.

  8. Follow the on-screen instructions

Creating an HTML Button

Buttons can be placed in a predefined region template position or among items in a form. To create an HTML button, select one of the following while running the Create Button Wizard:

  • Under Task, select Create a button in a region position.

  • Under Button Type, select a button type and then HTML Button (default).

Creating Multiple Buttons

You can create multiple buttons within the same region at once using the Create Multiple Buttons Wizard.

To create multiple buttons at once:

  1. Navigate to the appropriate Page Definition:

    1. Navigate to the Workspace home page.

    2. Click the Application Builder icon.

    3. Select an application.

    4. Select a page.

      The Page Definition appears.

  2. If necessary, create an HTML region. See "Customizing Regions".

  3. Under Buttons, click the Create icon.

    The Create Button Wizard appears.

  4. Select Create Multiple Buttons at the bottom of the page.

    The Create Multiple Button Wizard appears.

  5. From Place Buttons in Region, select the region to contain the buttons.

  6. From Template, select a template.

  7. In HTML Attributes, specify HTML attributes for these buttons. This text will be added to the HTML element definition. For example, you could set the class of a text button as follows:

    class="myclass"
    
    
  8. To quickly populate the remaining fields, make a selection from the Quick Button list on the right side of the page.

  9. Click Create Buttons.

Understanding the Relationship Between Button Names and REQUEST

The name you give a button determines the value of the built-in attribute REQUEST. You can reference the value of REQUEST from within PL/SQL using the bind variable :REQUEST. By using this bind variable, you can conditionally process, validate, or branch based on which button the user clicks. You can also create processes that execute when the user clicks a button. You can also use a more complex condition as demonstrated in the following examples:

If :REQUEST in ('EDIT','DELETE') then ...
If :REQUEST != 'DELETE' then ...

These examples assume the existence of buttons named EDIT and DELETE. You can also use this syntax in PL/SQL Expression conditions. Be aware, however, that the button name case is preserved. In other words, if you name a button LOGIN, then a request looking for the name Login will fail. For example:

<input type="BUTTON" value="Finish" onClick="javascript:doSubmit('Finish');">

Note that in this example Finish is the name of the REQUEST and this example is case-sensitive.

About Branching with Buttons

Each page can include any number of branches. A branch links to another page in your application or to a URL. The HTML DB engine considers branching at different times during page processing. You can choose to branch before processing, before computation, before validation, and after processing. Like any other control in Application Builder, branching can be conditional. For example, you can branch when a user clicks a button. When you create a branch, you associate it with a specific button. The branch will only be considered if a user clicks the button.

Displaying Buttons Conditionally

You can choose to have a button display conditionally by editing attributes on the Edit Pages Button page.

To have a button display conditionally:

  1. Create the button. See "Creating a Button Using a Wizard".

  2. Navigate to the appropriate Page Definition:

    1. Navigate to the Workspace home page.

    2. Click the Application Builder icon.

    3. Select an application.

    4. Select a page.

      The Page Definition appears.

  3. Under Buttons, select the button name.

    The attributes page for the button appears.

  4. Scroll down to Conditional Button Display.

  5. Make a selection from the Condition Type list.

  6. Enter an expression in the fields provided.

  7. Click Apply Changes.