Title: Introduction To Form Builder
1Introduction To Form Builder
2Objectives
- Use Sequence to generate value in a form
- Create List Of Value (LOVs)
- Form items
3Form Triggers
- PL/SQL procedure that runs in response to a user
or system action - Clicking a button
- Loading a form
- Exiting a form
- Triggers can be associated with
- An entire form (form level)
- A block (block level)
- A specific form item (item level)
4Using Sequences to Generate Primary Key Values
- Form can be set up to automatically retrieve next
sequence number and populate primary key field - Form triggers respond to user events or system
actions - To create a trigger, specify
- Triggers object (i.e. specific button)
- Trigger event (i.e. button press)
- Code that executes
- Use PRE-FORM event to perform action when form
loads - Use Triggers dialog box to create triggers for
objects
5PL/SQL Editor
6Syntax Error in PL/SQL Editor
7Creating Form Triggers (continued)
- Triggers dialog box
- Shows all block events that can have associated
triggers - Search using wildcards
- PL/SQL Editor
- Environment for writing, compiling, and editing
PL/SQL programs - Source code pane
- Status line
8Triggers Dialog Box
9Using Form Triggers
- Creating a trigger
- select the form or form item event
- type the trigger code
- Referencing a form item in PL/SQL code
- block_name.item_name
- Triggers are compiled before a form is run
10Using Sequences in Forms
- Create a block-level WHEN-CREATE-RECORD trigger
- Trigger PL/SQL code
- SELECT sequence_name.NEXTVAL
- INTO block_name.item_name
- FROM DUAL
11LOV
12Form Lists of Values (LOVs)
- List of legal values that can be selected for use
in a form field
LOV command button
LOV display
13Creating a List of Values (LOV)
- Use a list of values (LOV) to eliminate user
errors - Pop-up list allows user to select value from list
of choices rather than typing - User can open LOV by
- Typing Ctrl-L with cursor in LOV text field
- Click Edit then Display List from Forms Services
menu - Clicking command button with attached trigger to
open LOV - LOV allows user to search for values using
wildcards - LOV data values come from a record group
14LOV Display
15Creating an LOV
- To create LOV
- Use LOV Wizard
- Manually create using Object Navigator
- LOV can contain one or more columns
- LOV appearance can be customized using layout
wizard - Create a button on main form to launch LOV using
button tool, attach form trigger to button that
opens LOV
16Creating an LOV Using the LOV Wizard
- Use the LOV Wizard to
- Specify the LOV display records using a SQL query
- Format the LOV display
- Attach the LOV to a form text item
- Change the LOV and record group name in the
Object Navigator
17Opening the LOV Display
- Place the insertion point in the text item to
which the LOV is attached - Press CTRLL, or from Edit menu of the form
choose the option Display List
18LOV Command Button Trigger
- Create a trigger for the button that does the
following - Places the form insertion point in the text item
to which the LOV is attached - GO_ITEM(IN_VID)
- Executes the LIST_VALUES command
- LIST_VALUES
19Create an LOV
- Right-click anywhere in module REGISTRATION and
select LOV wizard - Select record group based on a query
20Create an LOV
- Type in a query that would retrieve all records
from table course (do not put a semi-column at
the end) - Here you will may be asked to log into the DB
21Create an LOV
- Select all the columns that you want to appear in
you LOV
22Create an LOV
- Specify the return value for COURSENAME field
- Return value is a field where the course name
from your LOV will be inserted
23Create an LOV
- Specify title and dimensions
- Specify the number of rows displayed at once
24Create an LOV
- Select COURSENAME as assigned value
- Complete your LOV
25Create an LOV
- To test your LOV
- Run the form
- Click on CourseName field
- Press CTRLL
26Create an LOV control button
- Close your form in the browser
- Return to the Form buikder, Layout editor
- Click on the Control Button item in the toolbar
on the left and drag it to a desired location on
your canvas - Name your button using Property palette
27Create an LOV control button
- Right click on the button, and open PL/SQL editor
- Select Type TRIGGER, Name WHEN_MOUSE_CLICKED
- Type in code the code below
28Alternate Form Input Items
- Radio buttons
- Check boxes
29Radio Buttons
- Limits user to one of two or more related,
mutually exclusive choices
30Radio Groups
- Related radio buttons are part of a radio group
Radio group
Individual related radio buttons
31Creating Radio Buttons
- Radio buttons
- Represent data fields whose values must be one of
small set of mutually exclusive selections - Exist within radio group
- Select item type in Layout Wizard
- Manually create radio buttons
- Use Radio Button tool
- Change properties using Property Palette
- Align edges using Align Objects dialog box
32Creating a Radio Group
- Create the form using the Data Block and Layout
Wizards - Open the item Property Palette, and change the
Item Type value to Radio Group - Draw and format the radio buttons on the canvas
- Modify the radio button properties
- Modify the radio group properties
33Important Radio Button Properties
Name how the button is referenced within the
form
Label description that appears next to the
button on the canvas
Radio Button Value associated data value in the
database
34Important Radio Group Properties
Name how the radio group is referenced within
the form
Initial Value data value of the radio button
within the radio group that is selected when the
form first appears
35Check Boxes
- Used to represent fields that can have one of two
values - Check box caption is interpreted as TRUE or FALSE
- If checked, caption is true
- If cleared, caption is false
36Check Box Example
37Creating a Check Box
- Create the form using the Data Block and Layout
Wizards - Open the item Property Palette, and change the
Item Type value to Check Box - Modify the item properties
38Creating Check Boxes
- Check boxes
- Represent data values that can have only one of
two opposing values - Label represents one value
- Value when Checked
- Value that will be saved in database if checkbox
checked - Value when Unchecked
39Important Check Box Properties
Label description that appears next to the
check box on the canvas
Value when Checked data value of the item when
the box is checked
Value when Unchecked data value of the item
when the box is checked
Check Box Mapping of Other Values check box
status when form first opens, or when new blank
record is added
40Convert Major into List Item
- In the Property palette, change item type to
list item
41Converting Major into a list item
- Add item values using the property palette