Working with Forms

Table of contents:

Forms are widely considered to be the most important building block for practically every application and are usually the best place to start when creating a new application. A successful application requires a balance between the collection and presentation of information to the end-user. In other words, fields should be created based on functional requirements and placed on the form in a manner that's easily understood by the user community.

Forms organize and provide structure to data records, or documents, in a Notes database. Using forms, you can display information in an organized fashion on the screen. Forms are also used to add new data or modify existing data. Virtually all Notes databases have one or more forms that are used to view and manipulate data records. In short, forms are the most important building block of a Notes database application.

Let's say, for example, that you have a Human Resource application used to manage employee information. For each employee in the company, there is a corresponding document in the database. Each document contains the employee name, Social Security number, birth date, hire date, employee number, department, and phone number (see Figure 4.3). This information is all related to one person and is stored in a single document. Using forms, you can

  • Add new employees to the database
  • Change existing data in the database (i.e., new phone number)
  • Manage what information is displayed on the form
  • Manage the layout of information on the form
  • Limit who can edit or see the information

Figure 4.3. Forms display information for a given document.

Note

Forms manage data content for a single document. Forms can be designed to display any number of fields associated with the document or none at all.

Many design objects are associated with a form. These objects define the look and feel of the form as well as how the form operates. The following table provides a summary of some of the objects that can be placed on a form. We'll review each of these objects in greater detail later in this chapter.

Object

Object Description

Action button

An action is performed when the user manually clicks a button. Action buttons display either in the action bar (located at the top of the application screen) or in the "Action" menu.

Event

The occurrence of a specific action and the ability to perform a task when that action, or event, occurs (e.g., display the message "Document Saved" when the user clicks the Save button).

Field

An object on a form or subform. Fields are used to enter, store, and display data.

Shared field

A special type of field that can be embedded or used on multiple forms. Enables developers to maintain code or field properties from a single location or instance.

Text

Static text displayed on the form, subform, page, etc. For example, a descriptive label next to a field or the title on a form.

Image

An image, picture, or graphic artwork (e.g., company logo).

Section

A group or collection of related information, which can be text, fields, graphics, buttons, etc. Sections can be expanded to view all information or collapsed under a single section title.

Layout region

A special region that allows fields, images, text, and other objects to overlap. Enables developers to manage multiple layers of information with precise control.

Subform

A special type of form that can be embedded in another form. Enables developers to maintain a common set of fields across multiple forms.

Table

A table that contains rows and columns. Tables can hold static text, fields, buttons, or other design elements.

Now that we've discussed how forms are used and the components that comprise them, let's look at two illustrationsone from the Designer's perspective, the other from the user's perspective. Figure 4.4 shows a form called Contact Information that includes descriptive text, fields, one shared field (RecordNo), two action buttons (Save and Close), a collapsible section for employee education, and a layout region with an edit control or text field.

Figure 4.4. Example form with design elements in Domino Designer

Now that you have seen a form in the Domino Designer client, let's take a look at the same form from the end-user's perspective using the Lotus Notes client (see Figure 4.5). Notice that the Save and Close buttons display at the top of the form and that the fields are framed with a box corner to show the start and end of each field. The layout region appears at the bottom of the form and includes a text area with a scroll bar.

Figure 4.5. Example form as displayed in the Lotus Notes client

Designer provides two methods to create forms in a database. Forms can be created from scratch or copied from a preexisting database. As a general rule of thumb, a form should be copied only when the form functionality and layout meets the needs of the new database. Otherwise, you'll probably find it easier to create a new form. This will limit potential problems of integrating a form from one database into another.

Note

When copying a form, all fields and property settings are duplicated in the new database. However, forms may contain references to other design objects stored external to the form. For example, an action button may reference a subroutine stored in a LotusScript library. These external objects are linked to each other. In other words, when copying a form into a new database, you may need to either copy other design objects from the source database or remove references that do not reside in the new database. There are several indicators that a form contains external references. Most notable is when a form cannot be opened in Lotus Notes and a message, such as "Illegal circular reference," is displayed. If this happens, you'll need to determine the conflicting or missing elements or delete the form. You may be able to determine what is causing the problem by deleting fields or source segments one by one and reopening the form (or database). You've identified the cause of the problem when the error no longer displays.

 

Creating a Form

Follow these steps to create a new form from scratch.

1.

Select the Create > Design > Form menu options, and a new form will be created. Alternatively, navigate to the Form section of the Design pane and click New Form.
 

2.

Next, define the layout of the form by adding fields, text, buttons, images, sections, and other design elements (described later in this chapter).
 

3.

The first time you save the form, you'll be prompted to specify a form name. Be sure to specify a meaningful primary name and alias name.
 

Copying a Form

Follow these instructions to copy a form.

1.

Open the source database, locate the form, and select it.
 

2.

To copy the form, select Edit > Copy.
 

3.

Now open the target database in Designer. By default, Designer will automatically display the application forms pane when the new database is opened (or created). If another design pane is displayed, be sure to navigate to the forms section before continuing.
 

4.

Finally, select menu options Edit > Paste to copy the form into the target database.
 

Note

A warning message will display when copying a form from a template database. A template is a special type of Notes database.

"The source database, 'MyProjects,' is a Design Template named 'Project Template.' After being pasted, would you like these forms to be automatically updated when those in the design template change?"

In other words, Designer is asking if you want to synchronize updates when the template changes. In most cases, you will want to select NO. This will ensure that any changes you make to the form are not lost when the template changes. Only select YES if you want the copied form to continue to match the form in the template database when the template is modified.

 

Hidden Forms

A hidden form is a form that does not display in the Create menu and is typically presented to the user through the implementation of application source code. In other words, hidden form does not mean the form cannot be displayed; it simply means the form is displayed using a method other than the menu options. A hidden form is created the same way as a regular form and contains the same elements: text, fields, layout regions, etc.

Forms are generally hidden when creating a dialog box, which is really just a form that's displayed differently. For example, using hidden forms, you can create custom popup dialog box windows that help the user perform a task or navigate the application.

For example, Figure 4.6 illustrates a hidden form. This hidden form is displayed in a dialog box and allows the user to specify the criteria for scheduling a recurring calendar appointment.

Figure 4.6. Example dialog box using a hidden form

To hide a form, enclose the form name in open and close parentheses, "( )". Only the primary name needs to be enclosed. However, for consistency, it's recommended that you also enclose the alias name as well, such as "(RepeatReservation) | (Repeat)" (see Figure 4.7).

Figure 4.7. Property settings to hide a form

Note

Hidden forms do not appear in the application menu even if the Include in menu option is selected in the form properties dialog.

Tip

Consider unchecking the Include in Search Builder option from the form properties dialog. More often than not, hidden forms are used to aid data entry and can be removed from a database text search. This will help make the search more efficient.



Working with Fields

An Introduction to the Lotus Domino Tool Suite

Getting Started with Designer

Navigating the Domino Designer Workspace

Domino Design Elements

An Introduction to Formula Language

An Introduction to LotusScript

Fundamentals of a Notes Application

Calendar Applications

Collaborative Applications

Reference Library Applications

Workflow Applications

Web Applications

Design Enhancements Using LotusScript

Design Enhancements Using Formula Language

View Enhancements

Sample Agents

Miscellaneous Enhancements and Tips for Domino Databases

Data Management

Security

Application Deployment and Maintenance

Troubleshooting

Appendix A. Online Project Files and Sample Applications

Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?



Lotus Notes Developer's Toolbox(c) Tips for Rapid and Successful Deployment
Lotus Notes Developers Toolbox: Tips for Rapid and Successful Deployment
ISBN: 0132214482
EAN: 2147483647
Year: N/A
Pages: 293
Authors: Mark Elliott

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net