A Look at JavaScript in Domino

Table 16.2 outlines the JavaScript Domino design elements for a form or page object in the Designer.

Table 16.2. JavaScript's Form Event Handlers

Form Event Handlers Trigger Event Description
OnLoad Works the same as the PostOpen event in Notes.
OnUnload Occurs before the document is cleared from memory.
OnSubmit Window event. Occurs before the document is saved.
OnReset Window event. Occurs before the document is reset or refreshed.
OnBlur Works the same as the Exiting event in Notes. Closes/exits the form.
OnClick Indicates that an object on a form is clicked.
OnDblClick Indicates that the user double-clicks a form element or link.
OnFocus Opens/edits the Notes form.
OnHelp Occurs when the key F1 is pressed.
OnKeyDown Occurs when the Down key is pressed.
OnKeyPress Occurs when a key is pressed or held down.
OnKeyUp Occurs when the Up key is pressed.
OnLoad Occurs when the browser finishes loading a window object.
OnMouseDown Occurs when a mouse button is pressed.
OnMouseMove Occurs when the user moves the cursor.
OnMouseOut Occurs when the cursor leaves the page or form.
OnMouseOver Occurs when the cursor moves over the form or page.
OnMouseUp Occurs when the user releases a mouse button.
OnUnload Occurs when a window is terminated by a user.

The JavaScript events for form elements (fields) are the same, with the exception of those in Table 16.3.

Table 16.3. JavaScript's Field Event Handlers

Field Event Handlers Trigger Event Description
OnFocus Upon entering the field object
OnBlur When exiting the field object
OnChange When the value of the field is changed
OnDblClick When the user double-clicks inside the form element (field)
OnClick When the user single-clicks inside the form element (field)
OnKeyDown When any key is pressed while the cursor is inside the field
OnKeyPress When any key is pressed or held down while the cursor resides inside the field
OnKeyUp When any key is pressed and released while the cursor is inside the field
OnMouseDown When a mouse button is pressed
OnMouseMove When the user moves the cursor inside the field
OnMouseOut When the cursor leaves the field
OnMouseOver When the cursor moves over the field
OnMouseUp When the user releases a mouse button
OnSelect Upon selecting text in the field

The JS Header is also a form object placeholder in which to store all the JavaScript functions that will be called from the form where it resides. Any functions placed in the JS Header pertain only to the form where they are placed; it cannot be shared with other forms. To share script across other objects in the database, you'll want to place the functions in a script library. Script libraries are treated as a shared resource and can be added to the Script Library section in the shared code area of the Design pane. Reusable functions, function definitions, and global declarations should be stored in the JS Header . Any inline script between tags inside the

tag on a document can be placed inside the JS Header as well. Figure 16.7 shows the JS Header with JavaScript functions inside the IDE.

Figure 16.7. The JS Header containing global declarations and functions for the form.


You can see the various global declarations as well as the other reusable functions for this form in Figure 16.7. The JS Header event is where the JavaScript code should be scripted and stored.

Several great uses for JavaScript exist in Domino and on the Web. Some of these are for input validation, dialog boxes, object manipulation, event handling, and communication with Java plug-ins. JavaScript can be coded to handle events in actions, buttons , and hotspots, as well as forms, pages, subforms, and fields. On the Web, JavaScript offers support for popular events such as onMouseOver for pop-up help, numeric calculations, dialog boxes, and even the addition of fields and the ability to build dynamic table on the fly. More important, you can use JavaScript for a single solution that works for both the Notes client and the Web browser. For examples of some of these uses, you'll want to explore Chapter 17.

Part I. Introduction to Release 6

Whats New in Release 6?

The Release 6 Object Store

The Integrated Development Environment

Part II. Foundations of Application Design

Forms Design

Advanced Form Design

Designing Views

Using Shared Resources in Domino Applications

Using the Page Designer

Creating Outlines

Adding Framesets to Domino Applications

Automating Your Application with Agents

Part III. Programming Domino Applications

Using the Formula Language

Real-World Examples Using the Formula Language

Writing LotusScript for Domino Applications

Real-World LotusScript Examples

Writing JavaScript for Domino Applications

Real-World JavaScript Examples

Writing Java for Domino Applications

Real-World Java Examples

Enhancing Domino Applications for the Web

Part IV. Advanced Design Topics

Accessing Data with XML

Accessing Data with DECS and DCRs

Security and Domino Applications

Creating Workflow Applications

Analyzing Domino Applications

Part V. Appendices

Appendix A. HTML Reference

Appendix B. Domino URL Reference

Lotus Notes and Domino 6 Development
Lotus Notes and Domino 6 Development (2nd Edition)
ISBN: 0672325020
EAN: 2147483647
Year: 2005
Pages: 288

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