ComputeWithForm (NotesDocument - LotusScript®)

Validates a document by executing the default value, translation, and validation formulas, if any are defined in the document form.

Defined in

NotesDocument

Syntax

flag = notesDocument .ComputeWithForm( doDataTypes , raiseError )

Parameters

doDataTypes

Boolean. The method ignores this parameter. Specify either True or False.

raiseError

Boolean. If True, an error is raised if the validation fails. If False, no error is raised; instead, the method returns False if validation fails.

Return value

  • True indicates that there are no errors on the document.
  • False indicates that there are errors on the document.

Usage

Notes® determines the form for the document using:

  1. The form stored in the document, if any.
  2. The contents of the Form item, if no form is stored in the document. Be sure to specify a Form item if the database default form does not represent the items in the document.
  3. The database default form, if the document does not have a Form item.

In the Notes® user interface, you must use a form to create a document. The document must meet the form's requirements for input validation, and the user interface informs you if the document does not meet these requirements. With the Notes® classes, you can create a document without a form. The ComputeWithForm method provides a means of checking that the data you've placed in a document meets a form's requirements, although (unlike in the user interface) you can still save a document if the ComputeWithForm returns False or raises an error.

When you create a new document, however, no form item exists in the back-end. To avoid having ComputeWithForm fall back to the default form, put a Form field on your form when you create it. That way, you start with something in the back-end, and you get the expected results from your new document. Otherwise, you can get results from fields that exist only in the default form, but not the document you create.

Example