Download presentation
Presentation is loading. Please wait.
1
Chapter 6: Creating Custom Forms
Guide to Oracle 10g
2
Lesson A Objectives After completing this lesson, you should be able to: Create and use custom forms Create command buttons that use form triggers to manipulate data Use the Forms Debugger to find form logic and runtime errors Work with form triggers Create form navigation triggers Guide to Oracle 10g
3
Introduction to Custom Forms
Displays data fields from variety of database tables Contains programs that support organizational processes Use lists of values (LOVs) to retrieve data values Manipulate data using form triggers Guide to Oracle 10g
4
Identifying the Business Processes and Database Operations
Identify processes that form supports Identify associated database tables Describe process Guide to Oracle 10g
5
Designing the Interface
Visualize how form will look Guide to Oracle 10g
6
Creating a Custom Form Manually create form canvas in Object Navigator
Create form items by “painting” items on canvas Using tools on Layout Editor tool palette Write code that controls form functions Guide to Oracle 10g
7
Creating the Form Canvas
Manually create form canvas in Object Navigator Start Forms Builder Create and rename form canvas Rename form module and form window Change Title property of form window Perform in Visual View in Object Navigator Guide to Oracle 10g
8
Creating a Control Block
Control data block Also called control block Data block not associated with particular database table Create new data block in Object Navigator Specify data block created manually Use Ownership View Guide to Oracle 10g
9
Creating the Form Items
Create Boilerplate logo image and text Form text items Command button items Display form in Layout Editor Draw items on form canvas using tools in tool palette Guide to Oracle 10g
10
Creating the LOVs LOV Use LOV Wizard Run form
Retrieve data from database table Use LOV Wizard Run form To test LOV Guide to Oracle 10g
11
Displaying System Date and Time Values in Form Text Items
System variable Variable representing value always available to any form Display value in text item automatically Set text item’s Initial Value property Guide to Oracle 10g
12
Forms Builder Date and Time System Variables
Guide to Oracle 10g
13
Creating Command Buttons
Create and configure buttons Create form triggers associated with buttons Guide to Oracle 10g
14
Creating and Configuring Command Buttons
Draw button on canvas using Button tool Button tool on tool palette Button group Buttons should all be same size Wide enough to accommodate longest button’s label Draw button with longest label first Guide to Oracle 10g
15
Creating the Button Triggers
Select Triggers node under button in Object Navigator Click Create button to create trigger Select trigger event Specify trigger code WHEN-BUTTON-PRESSED button event Trigger code executes when user clicks button Guide to Oracle 10g
16
Creating the Button Triggers (continued)
Reference form items: :block_name.item_name Clear form text items in form trigger: Use CLEAR_FORM built-in procedure Create program unit to set value of text items to blank text string Procedure Code block that executes commands to change one or more values Guide to Oracle 10g
17
Creating the Button Triggers (continued)
Function Code block Returns single value Create program unit: Open Object Navigator Select Program Units node Click Create button Program unit does not use DECLARE keyword Guide to Oracle 10g
18
Using the Forms Debugger to Find Runtime Errors
Error that does not keep program from compiling Generates error while program running Often result of user error Retrieve error messages associated with errors Forms Debugger Step through triggers and other PL/SQL programs one line at a time Examine variable values during program execution Guide to Oracle 10g
19
Retrieving FRM- Error Messages
Investigate nature of error by looking up error code explanation Oracle Technology Network (OTN) Web site FRM- prefix Forms Builder error codes ORA- prefix Generated by the DBMS Guide to Oracle 10g
20
Using the Forms Debugger
Click Run Form Debug button Set breakpoint Pauses execution on specific program command Examine current values of all program variables Step through program commands to observe execution path Examine variable values to see how values change Guide to Oracle 10g
21
Using the Forms Debugger (continued)
Breakpoint Pauses execution on specific command Set on: Program lines that contain executable program commands SQL queries To set: Double-click mouse pointer in gray shaded area on left side of PL/SQL Editor window Guide to Oracle 10g
22
Using the Forms Debug Console
Control form execution and examine form values Buttons: Go Step Into Step Over Step Out Execution arrow Shows program line to execute next Guide to Oracle 10g
23
Forms Debug Console Guide to Oracle 10g
24
Debug Console Windows Guide to Oracle 10g
25
Form Trigger Properties
Trigger activated In response to event such as clicking button Trigger name defines event that activates it Guide to Oracle 10g
26
Trigger Categories Guide to Oracle 10g
27
Trigger Timing Specifies when trigger fires PRE- POST-
Fire just before event successfully completes POST- Fire just after event successfully completes ON-,WHEN-, and KEY- Fire in response to actions Guide to Oracle 10g
28
Trigger Scope Defines where event must occur in order for associated trigger to fire Includes object to which trigger attached And objects within trigger object Guide to Oracle 10g
29
Trigger Execution Hierarchy
Defines which trigger fires When object within form object contains same trigger that form object contains By default trigger in higher-level object overrides trigger in lower-level object Can specify custom execution hierarchy Guide to Oracle 10g
30
Directing Form External Navigation
User causes form focus to change by making different form item active Form focus Item currently selected on form Internal navigation Result of internal form code that responds to external navigation operations or trigger commands Guide to Oracle 10g
31
Setting the Form Tab Order
Set tab order Place items in correct order under Items node In Object Navigator window Guide to Oracle 10g
32
Directing External Navigation Using Built-in Subprograms
Called built-ins Use to direct external form navigation Cannot use in navigational triggers Guide to Oracle 10g
33
Built-in Subprograms to Control External Navigation
Guide to Oracle 10g
34
Lesson A Summary Custom form Runtime errors Forms Debugger
Displays data fields from variety of database tables Processes data using triggers that contain SQL commands Runtime errors Errors that occur while form running Forms Debugger Create breakpoints that pause execution Guide to Oracle 10g
35
Lesson A Summary Form triggers support: Block processing
Interface events Master-detail processing Message handling Navigational events Query processing Transaction processing Validation Guide to Oracle 10g
36
Lesson B Objectives After completing this lesson, you should be able to: Suppress default system messages Create alerts and messages to provide system feedback to users Create applications that avoid user errors Trap common runtime errors Guide to Oracle 10g
37
Controlling System Messages
Forms Services message line Displays FRM- and ORA- messages Classified according to Severity Whether or not they require user intervention Suppress default system messages Replace with custom messages Set :SYSTEM.MESSAGE_LEVEL variable In PRE-FORM trigger Guide to Oracle 10g
38
Providing System Feedback
Important application design principle Provide users with feedback about what is happening in application Make applications forgiving Allow users to undo unintended operations Guide to Oracle 10g
39
Custom Messages Short text string that displayed on form message line
Up to 200 characters Syntax: MESSAGE('message_string'); Guide to Oracle 10g
40
Alerts Dialog box Top-level form object
Display text message longer than 200 characters Displays one or more buttons Allow user to select between alternatives that execute associated program statements Top-level form object Guide to Oracle 10g
41
Alerts (continued) Styles: Button Label property determines: Note
Caution Stop Button Label property determines: How many buttons appear on alert Labels on buttons Maximum 3 buttons Guide to Oracle 10g
42
Alerts (continued) To declare/display alert: DECLARE
alert_button NUMBER; BEGIN alert_button:= SHOW_ALERT('alert_name'); END; Guide to Oracle 10g
43
Example Alert Guide to Oracle 10g
44
Syntax to Display an Alert and Execute Alternate Commands Depending on the Button the User Clicked
Guide to Oracle 10g
45
Avoiding User Errors Help users avoid errors
Configure forms that validate input values Programmatically disable form command buttons Disable navigation for form text items containing values that users should not change Guide to Oracle 10g
46
Validating Form Input Values
Validate input values Ensure that values meet specific preset requirements Use Text item validation properties Form validation triggers Validation unit Represents largest chunk of data that user can enter before form validates all input values Guide to Oracle 10g
47
Text Item Validation Properties
Guide to Oracle 10g
48
Validating Form Input Values (continued)
Item validation trigger Item-level trigger Associate with item’s WHEN-VALIDATE-ITEM event Fires when item validated As determined by form validation unit If not valid Raises built-in exception named FORM_TRIGGER_FAILURE Guide to Oracle 10g
49
Disabling Form Command Buttons to Avoid User Errors
Enable or disable button while form running: SET_ITEM_PROPERTY('item_name', property_name, property_value); Guide to Oracle 10g
50
Disabling Text Item Navigation
Nonnavigable User cannot press Tab key to place insertion point in text item Set item’s Keyboard Navigable property to No User can still click mouse pointer in text item to enter value Create trigger that moves insertion point to another form item WHEN-MOUSE-UP event Guide to Oracle 10g
51
Generating Runtime Errors
Deliberately generate errors while updating and deleting records View error messages Guide to Oracle 10g
52
Trapping Form Runtime Errors
ON-ERROR event occurs Whenever ORA- or FRM- error occurs while form running Create form-level trigger that corresponds to ON-ERROR event Use decision control structure to handle different errors Guide to Oracle 10g
53
Forms Builder Built-in Procedures for Handling Errors
Guide to Oracle 10g
54
General Syntax for an ON-ERROR Trigger
Guide to Oracle 10g
55
Lesson B Summary Create custom messages and alerts
Provide feedback to users Validate user inputs using Text item validation properties Form validation trigger Guide to Oracle 10g
56
Lesson C Objectives After completing this lesson, you should be able to: Convert data blocks to control blocks Link data blocks to control blocks Create a form that has multiple canvases Create tab canvases Create stacked canvases Guide to Oracle 10g
57
Converting a Data Block to a Control Block
Use Data Block and Layout Wizards to create data block form and form layout Convert data block to control block Add command buttons to control form processing Simplify creation of control blocks Guide to Oracle 10g
58
Converting a Data Block to a Control Block (continued)
To convert data block to control block: Change data block’s Database Data Block property value to No Change Required property value of text item that represents data block table’s primary key to No Guide to Oracle 10g
59
Linking a Data Block to a Control Block
Create forms that link data blocks and control blocks to work together Usually represent master-detail relationship Guide to Oracle 10g
60
Creating the Data Block
Use Data Block Wizard and Layout Wizards To create and configure data block Must contain field that links it to control block Create data block without master-detail relationship Link two blocks later Guide to Oracle 10g
61
Linking the Control Block and the Data Block
Open detail data block’s Property Palette Modify data block’s WHERE Clause property General syntax: fieldname := control_block.text_item_name Guide to Oracle 10g
62
Refreshing the Data Block Values
Add commands to: Initially populate data block display Periodically refresh data block records Use the GO_BLOCK built-in: To move form focus to data block Then execute EXECUTE_QUERY built-in Flushes block Makes information consistent with corresponding database data Guide to Oracle 10g
63
Creating Forms with Multiple Canvases
Good practice not to show too much information on user’s screen display Single-form approach Create one form with multiple canvases Enables form to share data among different canvases Impossible for multiple programmers to work simultaneously on different canvases of same application Guide to Oracle 10g
64
Creating Forms with Multiple Canvases (continued)
Multiple-form approach Create multiple forms with different .fmb file for each application canvas Works well when multiple programmers collaborate to create complex application Enables programmers to use form in many different applications More difficult for related forms to share data Guide to Oracle 10g
65
The Northwoods University Student Services Process
Identify sequence of actions that user will employ to interact with canvases Guide to Oracle 10g
66
Interface Design Student Log On canvas Menu canvas
Student Information canvas Course Grades canvas Enrollment canvas Guide to Oracle 10g
67
Working with Multiple Canvases and Data Blocks
Create form that contains multiple canvases Create individual canvases Specify to display specific block items on specific canvas Create new data block Select canvas name on which block items appear On Layout Wizard Canvas page Guide to Oracle 10g
68
Working with Multiple Canvases and Data Blocks (continued)
Often forms that have multiple canvases also have multiple data blocks Group items that appear on same canvas in single data block To keep blocks small and manageable Cannot create two items that have same name in same data block Ensure that Forms Builder places new items in correct block Guide to Oracle 10g
69
Specifying the Block Navigation Order
Specify which canvas initially appears when user runs form Canvas whose block items appear first under Data Blocks node in Object Navigator window Order of canvases in Object Navigator Canvases list does not matter Only order of data blocks Guide to Oracle 10g
70
Object Navigator Guide to Oracle 10g
71
Referencing Different Canvases, Form Blocks, and Block Items
All form items have Canvas property Specifies name of canvas on which item appears Form always displays canvas on which item with focus appears Execute GO_ITEM built-in Move form focus to item on target canvas Good practice to include block name Guide to Oracle 10g
72
Creating and Configuring Tab Canvases in Forms
Multiple-page canvases Allow users to move between multiple canvas surfaces By selecting tabs at top of canvas Display large number of related items in modular way Direct user through sequence of steps for performing task Guide to Oracle 10g
73
Creating a Tab Canvas Contains two or more tab pages Tab page
Object representing surface Displays form items Has tab label identifier at top Guide to Oracle 10g
74
Creating a Tab Canvas (continued)
Create form that contains tab canvas Create form Create new content canvas in form Create tab canvas on content canvas Configure tab pages Guide to Oracle 10g
75
Creating Form Items on a Tab Canvas
Use tab pages as any content canvas Create items on tab pages Using Data Block Wizard By creating control block and drawing text items directly on tab canvases Must be sure to specify placement of items on tab canvas Guide to Oracle 10g
76
Lesson C Summary Convert data block to control block
Create relationship between control block and data block Display information on multiple canvases: Single-form approach Multiple-form approach Tab canvas Multiple-page canvas Guide to Oracle 10g
77
Summary Custom form Runtime errors Forms Debugger Form triggers
Create custom messages and alerts Validate user inputs Guide to Oracle 10g
78
Summary (continued) Convert a data block to a control block
Create relationship between control block and data block Display information on multiple canvases Tab canvas Guide to Oracle 10g
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.