JavaScript events

The following Domino objects have JavaScript event handlers: form, subform, page, field, action, button, and action hotspot. You can attach code to these event handlers in the Programmer's Pane. The code executes when the event occurs in a browser that supports the event, and, limitedly, in the Notes client.

Table of JavaScript events

The following table lists the JavaScript event handlers in Domino Designer. Browser only means that the event handler only works in browsers that support it. Browser and Notes means that the event handler works in browsers that support it and the Notes client.

Event

Form, subform, page

Field

Action, button, hotspot

JSHeader

Browser and Notes

Uses the JSHeader for the form, subform, or page

onBlur

NA

Browser and Notes

Browser only

onChange

NA

Browser and Notes

NA

onClick

Browser only

Browser only

Browser and Notes

onDblClick

Browser only

Browser only

Browser only

onFocus

NA

Browser and Notes

Browser only

onHelp

Browser and Notes

NA

Browser only

onKeyDown

Browser only

Browser only

Browser only

onKeyPress

Browser only

Browser only

Browser only

onKeyUp

Browser only

Browser only

Browser only

onLoad

Browser and Notes

NA

NA

onMouseDown

Browser only

Browser only

Browser only

onMouseMove

Browser only

Browser only

Browser only

onMouseOut

Browser only

Browser only

Browser only

onMouseOver

Browser only

Browser only

Browser only

onMouseUp

Browser only

Browser only

Browser only

onReset

Browser only, form only

NA

NA

onSelect

NA

Browser only

NA

onSubmit

Browser and Notes

NA

NA

onUnload

Browser and Notes

NA

NA

Events that work in browsers and the Notes client

Restrict code that must work in both a browser and the Notes client to the following events:

  • For document preprocessing and post-processing, use onLoad, onUnload, and onSubmit.
  • For processing on entering and exiting fields, use onFocus, onBlur, and onChange.
  • For an action, button, or action hotspot, use onClick.

JSHeader event

JSHeader is a special event handler that loads code such as functions and global variable declarations that all the events in the object can access. This code goes under the <HEAD> tag in Domino-generated HTML.

onSubmit event

The onSubmit event occurs in a browser and the Notes client when the FileSave @command executes. In a browser, you can return false from the onSubmit event to abort the save operation.

Enabling JavaScript in the Notes client

To run JavaScript in a Notes client, the user must select Enable JavaScript under Additional Options after choosing File > Preferences > User Preferences. To expand or limit security, the user must select Using JavaScript under What Others Do after choosing File > Security > User Security.