Professional Documents
Culture Documents
IS 333 - Form Builder Manual PDF
IS 333 - Form Builder Manual PDF
2012
Table of Contents
How to Start Oracle Form Builder ...........................................................................................4
How does Forms Builder translate the form designer specification into a Java Applet ?........... 7
Exploring the Form Builder .....................................................................................................8
What is an Object Navigator?...................................................................................................... 8
Definitions ................................................................................................................................. 10
Types of views ........................................................................................................................... 11
How to view a Form in a Run mode? ........................................................................................ 12
How to view information on database errors? ......................................................................... 13
Modifying FORM Properties ...................................................................................................... 14
Intersection mode ................................................................................................................. 16
Layout editor after changing the properties ......................................................................... 17
Ensuring a Consistent Appearance Across Form Modules ...................................................... 20
Why it is important to maintain a consistent look and feel? .................................................... 20
Two ways to standardize the appearance of multiple forms in an application: ....................... 20
Template Forms ................................................................................................................... 20
Steps to create the template form ............................................................................................ 20
Visual Attribute Groups........................................................................................................ 36
Steps to create visual attribute group for form text items ....................................................... 36
Creating a Form Based on a Template Form .......................................................................... 40
Steps to create a new form using the template ........................................................................ 40
Applying The Visual Attribute Group to The Form Text Items ................................................ 53
Steps to apply the visual attribute group .................................................................................. 53
Referencing Application Components ................................................................................... 58
Using the Path Specification Approach ..................................................................................... 58
Global Path Variable .............................................................................................................. 58
Opening and Closing Forms in an Integrated Database Application ........................................ 59
Steps to create a Home Page form using the template ............................................................ 59
Opening forms in an Integrated Database Application ............................................................. 65
CALL_FORM ........................................................................................................................... 65
OPEN_FORM .......................................................................................................................... 66
NEW_FORM ........................................................................................................................... 67
How does Forms Builder translate the form designer specification into a
Java Applet ?
It uses a Web server process called an Oracle9iAS Containers for J2EE, or (OC4J)
Instance.
When developing, workstation runs web server and web browser in its main
memory.
Form Builder development environment compiles the form design file ( .fmb) to a
file (.fmx) and send the complied .fmx file to the OC4J Instance, which inturn
translates the compiled .fmx file into a Java applet and then downloads the Java
Applet to your web browser.
Click File, Open, select CUSTOMERDEMO (an example of a previously created & saved form)
Definitions
Block :
o A block is a structure that contains a group of objects such as text fields
or command buttons or option buttons
Data Block :
o A data block is a block that is associated with a database table. When you
create a data block using wizard, the system automatically generates the
text items and labels for data fields in that table and provides the code
for inserting, modifying, deleting and viewing data records.
Data block form: one or more data blocks
Text items: most common block items which display text data values in text
fields
Window :
o Rectangular area on a computer screen that has a title bar at the top.
o Windows have horizontal and vertical scroll bars.
o Windows can be resized, maximized and minimized.
Canvas :
o A canvas is the area in a window in which you place graphical user
interface ( GUI) objects, such as buttons and text fields.
Items : are form objects that a user sees and interacts with on the canvas.
Trigger : A Trigger is a PL/SQL program that starts in response to an event. An
event is a response to a user or system action, such as clicking a button or
loading a form, that occurs in a window application.
Relation : A relation is a form object that Forms builder creates for a form that
displays two data blocks whose underlying database tables have a foreign key
relationship.
Types of views
1. Ownership view :
a. Presents the form as the top level object and then list all form object nodes
on the next level. In this view, data blocks, canvases and windows all appear
as objects directly below the form module.
d. It is useful for quickly accessing specific objects without having to open all of
the higher level objects.
2. Visual view :
a. Presents how form objects contain other objects i.e. a form contains
window, a window contains canvases, and a canvas contains data block.
Intersection mode
We can use property palette in intersection mode to modify one or more properties of a group
of objects so that all objects in the group have the same value or values.
Indicates is in
intersection mode
Template Forms
It is generic form that includes standard form objects that appear in every form
in an application, (e.g. graphics, command buttons, and program units)
Ensures a uniform overall appearance for application forms
You store the template form in a location that is accessible to all developers.
In this manual, we’ll create a template form for the Northwoods University database.
Oracle
Northwoods
University
Logo
Return
2. In the Object Navigator, select the MAIN node, and then click the Collapse All
button to collapse the MAIN form objects.
3. Select the top level Forms node, and then click the CREATE button to create a
new form. Change the form module name to NORTHWOODS_TEMPLATE.
4. To create the new canvas, select the Canvases node and then click the Create
button. Change the canvas name to TEMPLATE_CANVAS.
5. To configure the template window, open the Windows node, and change the
form window name to TEMPLATE_WINDOW. Select the TEMPLATE_WINDOW
node, right-click, and then click PROPERTY PALETTE. Change the Title property
value to Northwoods University, and then close the Property Palette.
9. To create the boilerplate Rectangle, select the rectangle tool on the tool palette,
and draw a rectangle that defines the area that contains the logo and return
button. The rectangle should start at the top-left corner of the canvas, and
should extend the entire length of the canvas. The rectangle’s bottom edge
should be even with the bottom edge of the canvas.
10. Select the rectangle if necessary, select the Fill Color tool on the tool palette,
and change the rectangle fill color to a lighter shade of gray than the canvas
background color. The filled rectangle should appear slightly lighter than the rest
of the canvas.
11. Make sure that the rectangle is still selected, select the Line Color tool on the
tool palette, and then click No Line.
12. To import the Northwoods University logo, click Edit on the menu bar, point to
Import, and then click Image. Click Browse, navigate to
NorthwoodsProject_DONE folder, select NWlogo.jpg, click Open, and then click
Ok. The logo appears on the canvas. Resize and reposition the logo.
13. To create the return button, select the Button tool on the tool palette, and draw
the button. Double-click the button to open its Property Palette, change the
button properties as follows, and then close the Property Palette:
Name RETURN_BUTTON
Label Return
Width 90
Height 16
14. To create the button trigger, select the button, right-click, point to
SmartTriggers, and then click WHEN-BUTTON-PRESSED. Type the following
command, compile the trigger, debug it if necessary, and then close the PL/SQL
Editor.
EXIT_FORM;
15. Click Window on the menu bar, and then click Object Navigator to open the
Object Navigator. Note that when you create the Return button, Forms Builder
automatically created a new control block that contains the button. Change the
new block name to TEMPLATE_BLOCK, and then save the form.
2. Select the new visual attribute group, right-click, and then click Property Palette.
Change the Name value to TEXT_ITEM_VISUAL_ATTRIBUTES.
3. Make sure that the Visual Attribute Type property value is Common, which
means that the specified properties apply to all attributes in the object; while
Prompt apply only to object prompts, and Title apply only to object titles.
4. To specify that the text appears in a dark blue color, select the Foreground Color
property, click the More button , and then select a dark blue square.
5. To specify that the text appears on a white background, select the Background
Color property, click the More button, and type (or select) white in the property.
6. Select the Font Name property, click the More button, select Arial, and then
click OK. Select the Font Size property, delete the current value, and then type 8.
7. Close the Property Palette, save the form, and then close the form in the Forms
Builder.
3. To create the new data block, select the Data Blocks node, click the Create
button, make sure the Use the Data Block Wizard option button is selected, and
then click OK. When the Data Block Wizard Welcome page appears, click Next.
4. When the Type page appears, make sure the Table or View option button is
selected, and then click Next. On the Source page, click Browse, select the
LOCATION database table, and click OK. Click the Move all items to target
button to select all of the table fields for the data block, leave the Enforce
data integrity check box cleared, and then click Next.
5. When the Master-Detail page appears, click Next because you do not want to
create a master-detail relationship. Accept LOCATION for the data block name,
and click Next. When the Finish page appears, make sure that the Create the
data block, then call the Layout Wizard option button is selected, and then click
Finish.
6. When the Layout Wizard Welcome page appears, click Next. Accept the default
values on the Canvas page, and then click Next. (Recall that you are basing the
new form on the template form, and the template form’s canvas name is
TEMPLATE_CANVAS.)
7. On the Data Block page, click to select all of the data block fields for the
layout, and then click Next. On the item page, accept the default prompt values,
and then click Next.
8. On the Style page, make sure that the Form option button is selected, and then
click Next. On the Raw page, type Location for the frame title, leave the Records
Displayed value as 1, click Next, and then click Finish.
9. In the Layout Editor, the new data block objects are not visible because they
appear below the existing form template objects. Scroll to the bottom of the
window, select the Location frame, and drag it to the top of the canvas. Resize
the frame, and format the text item labels, so your form looks like the figure
below
2. Click Tools on the menu bar, and then click Property Palette to open the
intersection Property Palette for the text item object group.
3. Scroll down to the Visual Attributes property node, select the Visual Attribute
Group property, open the list, and select TEXT_ITEM_VISUAL_ATTRIBUTES.
4. Close the Property Palette, and save the form. Note that the form text items now
appear as a dark blue text on a white background, in an 8-point Arial Regular
font, as specified in the custom visual attribute group.
5. Run the form, click Enter Query button, and then click the Execute Query
button. Step through the table records to view the records, and then close the
browser window.
Steps to use the path specification approach: refer to Step #2 in How to create a button
with a CALL_FORM procedure
Uses: for development team that has standardized procedures for saving all of the
project files to a specific location on a file server
Advantage: enables you to place the path information in a single location. So that
whenever you move the application files to a new location, you only have to change the
specification in the global path variable, instead of changing it in many different
locations.
CALL_FORM(:GLOBAL.PROJECT_PATH || 'EXIT_PAGE');
Steps to use the global path variable: refer to How to create a Log-In Page form part.
4. To edit the new form, right-click on HOME_PAGE, and then click on Layout
Editor.
5. In the Layout Editor, click on the Text button on the tool palette, and then draw
it in the middle of the form. To enter a welcome text, type Welcome to
Northwoods University Database.
6. To change the format of the welcome message, change the Font to Arial, the
Font Size to 16, make it Bold, and then move it if necessary.
CALL_FORM
This procedure opens a child form and immediately switches the application focus to
the child form.
Uses: You can use it when the user clicks a switchboard button or selects a menu item,
and expect to see the child form immediately.
Parameter Description
Form_specification Specifies the child form. Always enclosed in single quotation marks.
Type the child form name if it is located in the default form folder, or
specify the full path and file name, including the drive letter, to the child
form’s .fmx file, or you can use the global path variable as following:
:GLOBAL.project_path || ‘form_name.fmx’
Display Specifies whether the parent form is hidden by the child form (HIDE)
“default value”, or not hidden (NO_HIDE) which is used if you want the two
forms to appear side by side on the screen
Switch_menu Specifies whether the child form displays the same pull-down menus as its
parent form (NO_REPLACE) “default value”, or displays different menus
(DO_REPLACE)
Query_mode Specifies whether the child form runs in normal mode, in which the user
can insert, update, or delete values (NO_QUERY_ONLY)”default value”, or
in query mode, in which the user can only view data (QUERY_ONLY)
Parameter_list_id Specifies the identifier for an optional parameter list that the parent form
can use to pass data values to the child form.
All of the parameters are optional except for form_specification. If you decide to specify a
value for any of the optional parameters, you must specify values for all of the
preceding optional parameter in the list, without including the values for the
subsequent optional parameters if you’re willing to accept the default value.
OPEN_FORM
This procedure opens a child form and gives the developer the option of not
immediately changing the application focus to the child form.
Uses: Many developers prefer this procedure because it allows the user to multitask
between parent and child forms in the application.
Parameter Description
Form_specification Same as in CALL_FORM
Active_mode Specifies whether the application focus switches to the child form
(ACTIVATE) “default value”, or is retained by the parent form
(NO_ACTIVATE)
Session_mode Specifies whether the child form uses the same database session as the
parent form (NO_SESSION) “default value”, or whether the child form
starts a new database session (SESSION).
In the first case, the DBMS commits all uncommitted values in both forms
when a COMMIT command executes. Therefore, the benefit of the second
case is that whenever a COMMIT command is issued, transactions are
committed only in the form in which the commit command executes,
allowing the developer to control how the form commit transactions.
Parameter_list_id Same as in CALL_FORM
All of the parameters are optional except for form_specification. If you decide to specify a
value for any of the optional parameters, you must specify values for all of the
preceding optional parameter in the list, without including the values for the
subsequent optional parameters if you’re willing to accept the default value.
NEW_FORM
This procedure opens a child form, and immediately exits the parent form.
Uses: use it to allow users to open application forms without going through the main
form switchboard or menus. The advantage: it prevents the user from opening multiple
forms at once, which consumes system memory. But because users should access all
application forms from the main form, it is not recommended to this procedure.
Parameter Description
Form_specification Same as in CALL_FORM
Rollback_mode Specifies whether the DBMS automatically commits records in the parent
form and doesn’t roll back any uncommitted transactions (NO_ROLLBACK),
rolls back all uncommitted transactions/records to the last save point
(TO_SAVEPOINT), or rolls back all uncommitted transactions/records and
restore the database to its state at the beginning of the database session
(FULL_ROLLBACK).
Query_mode Same as in CALL_FORM
Parameter_list_id Same as in CALL_FORM
To create a button with a CALL_FORM procedure (you can try the other two
procedures):
1. To create a button trigger that calls the form LOCATION, select the Button tool
on the tool palette, and draw the button as shown below. Double-click the
button to open its Property Palette, change the button properties as following,
and then close the Property Palette:
Name GO_LOCATION_BUTTON
Label Location
Width 90
Height 16
3. Save the form, and then Run the form. When the HOME_PAGE form appears,
click Location button. The Location form (LOCATION.fmx) opens.
CLOSE_FORM
This procedure closes a specific form, which might not be the form the user is currently
viewing.
Syntax: CLOSE_FORM(‘form_specification’);
Parameter Description
Form_specification The form_ID (created by the Form Builder for every open form) or the
name of the form module as specified in the Object Navigator
EXIT_FORM
This procedure closes the current form.
Uses: to create a trigger for an Exit button that the user clicks to close a form.
Parameter Description
Commit_mode Specifies how the DBMS handles umcommited form data.
(ASK_COMMIT) “default value” causes the form to ask the user to save
uncommitted changes, (DO_COMMIT) automatically commits unsaved
data, (NO_COMMIT) automatically discards uncommitted changes.
Rollback_mode Specifies if the DBMS automatically commits or rolls back uncommitted
records in the parent form.
Same as in NEW_FORM
Both parameters are optional.
Refer to the steps: 13 - 14 on of creating a template form (you can also try the
CLOSE_FORM procedure).
3. Change the Data Block name to LOGIN _BLOCK, Canvas name to LOGIN
_CANVAS, and Window name to LOGIN _WINDOW
4. To edit the new form, right-click on LOGIN _PAGE, and then click on Layout
Editor.
5. In the Layout Editor, to create a text item (that will be used by students to enter
their usernames and passwords), select the Text Item tool on the Layout Editor
tool palette, and then draw the text item on the form.
6. To configure the text item, right-click on the text item, click on Property Pallet,
then modify the following properties:
Name S_ID
Data Type Char
Maximum Length 6
Prompt Student_ID
Visual Attribute Group (optional)
8. Repeat the previous steps to create a text item for the password with the
following properties:
Name S_PIN
Data Type NUMBER
Maximum Length 4
Prompt Password
Visual Attribute Group (optional)
9. To resize the text items, select all of the items as an object group, right-click, and
then click Property Palette. Scroll down to the Physical property node, then
change the Width property value to 80, and the Height property value to 14.
Close the Property Palette. The text items now all appear as the same size.
10. To reposition the text items, select the first five of the text items only as an
object group, click Layout on the menu bar, and then click Align Components.
Select the Align Left option button to specify the horizontal alignment, select the
Stack option button to specify the vertical alignment, and then click OK.
11. To create a Submit button trigger, select the Button tool on the tool palette, and
draw the button as shown below. Double-click the button to open its Property
Palette, change the button properties as following, and then close the Property
Palette:
Name SUBMIT_BUTTON
Label Submit
Width 60
Height 16
12. In the Layout Editor, select the Submit button if it is not already selected. Then
click the Copy button on the tool bar to copy the button, and click the Paste
button to paste the copied button onto the form. Forms Builder pastes the new
button directly on top of the first button. Select the pasted button, and drag it
below the original Submit button.
13. Select both buttons as an object group, click Layout on the menu bar, and then
select Align Components. Select the Align Left option button to align the buttons
horizontally, and select the Distribute option button to evenly space the buttons
vertically, and then click OK. Position the button group on the form.
14. Select the second button, open its Property Palette, change its Name property to
CANCEL_BUTTON and its Label property to Cancel, and then close the Property
Palette. Then save the form.
After the Student has entered his/her username and password, they need to click
Submit button to log in. The Submit button trigger must check entered values against
the S_ID and the S_PIN columns in the STUDENT table. If these values exist in the
Student table, the student is able to log into the system and check other forms.
15. In the Object Navigator, open the Triggers node under the LOGIN_PAGE form
module. Select the PRE_FORM node, right-click, and then click PL/SQL Editor.
The PRE_FORM trigger opens in the PL/SQL Editor.
16. To create the global path variable, add the following command as the first
command in the trigger:
17. To create the button trigger, select the Submit button, right-click, point to
SmartTriggers, and then click WHEN-BUTTON-PRESSED. Type the following
command, compile the trigger, debug it if necessary, then close the PL/SQL
Editor, and save the form. (this step is similar to step # 14 in how to create a
template form).
DECLARE
CURSOR STUDENT_LOGIN_CURSOR IS
SELECT S_ID, S_PIN
FROM STUDENT
WHERE S_ID = :LOGIN_PAGE_BLOCK.S_ID
AND S_PIN = :LOGIN_PAGE_BLOCK.S_PIN;
STUDENT_RAW STUDENT_LOGIN_CURSOR%ROWTYPE;
ATTEMPT NUMBER :=0;
BEGIN
WHILE ATTEMPT < 4 LOOP
OPEN STUDENT_LOGIN_CURSOR;
FETCH STUDENT_LOGIN_CURSOR INTO STUDENT_RAW;
IF STUDENT_LOGIN_CURSOR%FOUND THEN
MESSAGE('Log in Successfully');
CALL_FORM(:GLOBAL.PROJECT_PATH ||
'HOME_PAGE');
ELSE
MESSAGE('Wrong Username and/or Password');
:LOGIN_PAGE_BLOCK.S_ID := '';
:LOGIN_PAGE_BLOCK.S_PIN := '';
GO_ITEM('LOGIN_PAGE_BLOCK.S_ID');
ATTEMPT := ATTEMPT + 1;
END IF;
END LOOP;
CALL_FORM(:GLOBAL.PROJECT_PATH || 'EXIT_PAGE');
END; +comments
An alternative way to create a trigger and open the PL/SQL is from the Object
Navigator. Click on Window on the menu bar, and then click Object Navigator. Open
the SUBMIT_BUTTON node, select the Triggers node, and then click the Create
button to create a new trigger. Scroll down the list of events, and double-click
WHEN-BUTTON-PRESSED. The PL/SQL editor opens.
18. To test the trigger, run the form, choose a Username (S_ID) and a Password
(S_PIN) from the Student table to test, then click Submit. If you enter a correct
combination, an alert message appears, click OK, then the HOME_PAGE form
opens.
19. Test the form to see what happens if you enter a faulty combination and see
how an alert message appears, click OK. After exemption the three trials, the
EXIT_PAGE form opens. (The EXIT_PAGE form is created, compiled, and tested
before running the LOGIN_PAGE form to create the EXIT_PAGE.fmx file. This form
was created for illustration purposes only)
20. To create the button trigger, select the Cancel button, right-click, point to
SmartTriggers, and then click WHEN-BUTTON-PRESSED. Type the following
command that will clear the text items, compile the trigger, debug it if necessary,
then close the PL/SQL Editor, and save the form.
:LOGIN_PAGE_BLOCK.S_ID := '';
:LOGIN_PAGE_BLOCK.S_PIN := '';
21. To test the trigger, run the form, type any combination for the username and
password, and then click on Cancel. Notice how the fields are cleared now.
Problem:
When trying a fault combination of username and password three times, it doesn’t go to
the EXIT_PAGE form. I tried to solve it but couldn’t. I think there is a problem with the
ATTEMPTS variable.