code (Domino DTD)

Represents programming code.

Containment Hierarchy

Contained by: <action>, <agent>, <area>, <actionhotspot>, <appletparameters>, <appletresource>, <button>, <bordercaption>, <column>, <computedtext>, <databasescript>, <embeddedview>, <embeddednavigator>, <field>, <folder>, <form>, <frameset>, <globals>, <imageref>, <javaapplet>, <page>, <pardef>, <picture>, <popup>, <scriptlibrary>, <section>, <sectiontitle>, <subform>, <subformref>, <view>, %link.computed.content;

Contains: %code.types;

Syntax

<!ELEMENT code ( %code.types; )>

Content

%code.types;

Contains any of the coding language options in the %code.types; entity (the <formula>, <lotusscript>, <javaproject>, <simpleaction>, and <javascript> elements).

Attributes

<!ATTLIST code

event

%string;

#REQUIRED

for

%tokens;

#IMPLIED

enabled

%boolean;

#IMPLIED

>

enabled

Boolean. Applies in only those places in the Notes UI where you do not have the option to select a check box to enable code, for example, in a hide when formula for a paragraph. When the code is valid, defaults to true.

event

Name of a built-in event or a user-defined LotusScript function.

for

List of keywords from the %code.for.tokens; entity. This attribute identifies where the code is executed in those instances where Web and Notes client execution are both possible.

Defined entities for <code> element

The %code.databasescript.lotusscript.or.formula.events; entity lists the types of events that trigger LotusScript or Formula language code through a databasescript. This entity is used in the following entity: %code.lotusscript.or.formula.events;

Syntax:

<!ENTITY % code.databasescript.lotusscript.or.formula.events "querydocumentdelete | querydocumentundelete| postdocumentdelete | querydroptoarchive| postdroptoarchive ">

The %code.events; entity lists the types of events that trigger code execution.

Syntax:

<!ENTITY % code.events "%code.formula.events; | %code.lotusscript.events;| %code.lotusscript.or.formula.events; | %code.javascript.events; ">

The %code.for.tokens; entity lists the keyword token options of the for attribute. These keyword tokens indicate if the code is intended for use on the Web or in the Notes client. You only need to specify this attribute in those events where Domino Designer enables you to write code that can be triggered in either. The default in such events is web.

Syntax:

<!ENTITY % code.for.tokens "web | client ">

The %code.formula.events; entity lists the different events that trigger formula language code execution. This entity is used in the %code.events; entity.

Syntax:

<!ENTITY % code.formula.events "defaultvalue | inputtranslation | inputvalidation | windowtitle | webqueryopen | webquerysave | hidewhen | value | selection | htmlattributes | htmlhead | htmlbody | targetframe | helprequest | form | alternatehtml | showsinglecategory | label | displayvalue ">

alternatehtml

Alternate text to display if the user's browser cannot execute the code. For example, if a Java applet cannot be run by the user's browser, this text would describe the applet and inform the user that their browser's capabilities do not support it.

defaultvalue

Provides an initial value for a field.

displayvalue

Determines the value that displays for an action checkbox.

form

Defines which form to open from a view.

helprequest

Executes when Help is selected.

hidewhen

Hides the object if the formula you provide is true.

htmlattributes

Specifies characteristics for the associated HTML object. Applies to fields.

htmlbody

Information that resides in the HTML Body tag for an object. Applies to forms and pages.

htmlhead

Information that resides in the HTML Head tag for an object. Applies to forms and pages.

inputtranslation

Converts the data entered in the field to make the field conform to a specified format.

inputvalidation

Checks the data entered in the field against criteria that you specify.

label

Specifies the label to display on an action button.

selection

Selects the documents that appear in a view.

showsinglecategory

In embedded views, limits the documents displayed in the view to those contained in one category. The category is defined by a formula or text.

targetframe

Defines which frame in a frameset the result of a command should display in.

value

Specifies the contents of a computed field.

webqueryopen

Executes before a Web document is displayed.

webquerysave

Executes before a Web document is saved.

windowtitle

Generates the text that appears in the title bar of documents using the form.

The %code.javascript.events; entity lists the different events that trigger JavaScript code execution. This entity is used in the %code.events; entity.

Syntax:

<!ENTITY % code.javascript.events "onClick | onDblClick | onMouseDown | onMouseUp | onMouseOver | onMouseMove | onMouseOut | onKeyPress | onKeyDown | onKeyUp | onFocus | onBlur | onLoad | onUnload | onSubmit | onReset | onChange | onError | onHelp | onSelect | Queryopen | Queryrecalc | Postrecalc | Querymodechange | Postmodechange | Postsave | Querysend | Postsend | library">

These code events options execute when:

library

it onThe JavaScript script library is activated. Unlike LotusScript or Java, a JavaScript script is not attached to specific objects, nor can specific classes created in a JavaScript script be accessed from any agent or servlet.

onBlur

The object loses the input focus.

onChange

The content of an object has changed.

onClick

You press and release the mouse button.

onDblClick

You press and release the mouse button two times consecutively.

onError

An error occurs on loading.

onFocus

You give focus to an object.

onHelp

You press the F1 key while the browser is the active window.

onKeyDown

You press a key.

onKeyPress

You press and release an alphanumeric key.

onKeyUp

You release a key.

onLoad

The browser loads the object.

onMouseDown

You press the mouse button down.

onMouseMove

You move the mouse over an object.

onMouseOut

You move the mouse outside the boundaries of an object.

onMouseOver

You move the mouse pointer onto an object.

onMouseUp

You release the mouse button.

onReset

You reset a form.

onSelect

You select text in a text area or an input type text object.

onSubmit

Before a form is submitted.

onUnload

Before the browser unloads the object.

Postmodechange

After a document is changed to read or edit mode.

Postrecalc

After a database, view, folder, or document is recalculated.

Postsave

After a document is saved.

Postsend

After a document is sent.

Querymodechange

Before a document is changed to read or edit mode.

Queryopen

Before a view, folder or document is opened.

Queryrecalc

Before a view, folder or document is recalculated.

Querysend

Before a document is sent.

The %code.javascript.sections; entity lists the global sections that apply to the JavaScript events for the object.

Syntax:

<!ENTITY % code.javascript.sections " jsheader ">

jsheader

Header information for JavaScript events.

The %code.lotusscript.events; entity lists the different events that trigger LotusScript code execution. This entity is used in the %code.events; entity.

Syntax:

<!ENTITY % code.lotusscript.events "initialize | terminate | entering | exiting | onchange | objectexecute ">

These code event options execute when:

Focus enters a field.

Focus exits a field.

initialize

A database, view, folder, document, object, or agent is being loaded.

An action, button, or hotspot is activated by an OLE2 server that is FX/Notesflow enabled.

A user changes a field in edit mode.

terminate

A database, view, folder, document, object, or agent is being closed.

The %code.lotusscript.or.formula.events; entity lists the different events that trigger LotusScript or formula language code execution. This entity is included in the %code.events; entity.

Syntax:

<!ENTITY % code.lotusscript.events "action | onhelp | queryopen | queryrecalc | postopen | querymodechange | querysend | postsend | postmodechange | postrecalc | querysave | postsave | queryclose | click | regiondoubleclick | queryopendocument | queryaddtofolder | querydragdrop | querypaste | postdragdrop | postpaste | onload | onunload | onsubmit | queryentryresize | postentryresize | %code.databasescript.lotusscript.or.formula.events; ">

These code event options execute as follows:

action

When a user selects an action from the Actions menu or clicks an action button in the action bar.

click

When you select an action, button, or hotspot.

When a user presses the F1 key for context-sensitive Help.

After the current document is opened, but before the user has input focus.

Before the current document is saved.

Before the current document is closed.

postdragdrop

After a drag and drop operation in a database script or calendar folder or view.

After a calendar view entry is resized.

After a document is changed to read or edit mode.

postopen

After a database, view, folder, or document is opened.

After a paste operation in a folder or view.

After a document is refreshed and its values are recalculated.

After a document is saved.

After a document is sent.

Before a document is added to a folder.

queryclose

Before a database, view, folder, or document is closed.

querydragdrop

Before a drag and drop operation in a database script or calendar view or folder.

Before a calendar view entry is resized.

Before a document is changed to read or edit mode.

queryopen

Before a view, folder, or document is opened.

Before a document is loaded in a folder or view.

Before a paste operation in a folder or view.

queryrecalc

Before a view, folder, or document is recalculated.

Before a document is saved.

Before a document is sent.

When a region in a calendar view or folder is double-clicked.

The %code.lotusscript.sections; entity lists the global sections that apply to the LotusScript events for the object.

Syntax:

<!ENTITY % code.lotusscript.sections " options | declarations ">

These section options specify areas where you can write:

declarations

Non-executable LotusScript statements.

options

LotusScript statements, such as Option, Use, UseLSX, and Const.

The %code.sections; entity lists the types of global sections that apply to the events for the object.

Syntax:

<!ENTITY % code.sections " %code.lotusscript.sections; | %code.javascript.sections; ">

The %code.types; entity represents the coding languages that are supported by Notes. This entity contains the <formula>, <lotusscript>, <javascript>, <javaproject>, and <simpleaction> elements.

Syntax:

<!ENTITY % code.types " formula | javascript | lousscript | javaproject | simpleaction+ ">

Example

Example