Contact TLCC

Block Input in Domino Fields Click here to see all the Developer/Admin Tips

Date tip published:04/11/2005
Description:Notes Domino 6 introduced a new field event, Input Enabled. This can be used to prevent a field from being edited regardless of the person's access level in the database. For Notes Domino 6 the Input Enabled event only works for certain types of fields with the Native OS setting selected. Notes Domino 7 will expand on this functionality to disable editing of all fields regardless of type or their display setting. This tip contains a sample database to try out this feature.


To learn more about Notes/Domino 6 Application Development use the following links:

Notes Domino 6 Application Development 1
Notes Domino 6 Application Development 2
Notes Domino 6 Certified Developer Package




Block Input in Domino Fields

Many times a Domino Developer will want to prevent the editing of a field when certain conditions exist. These conditions maybe the role of the person who is currently editing the document or the status of the document. Previously the editing of a field could have been blocked via the use of hide-when formulas or the use of Controlled-Access Sections.

Notes Domino 6 introduced a new way to block editing of a field. There is a new event in the Domino Designer pane called "Input Enabled." If this formula evaluates to True (1) than the field can be edited. To block editing of this field the formula should evaluate to False (0).





Uses for Default Value Formulas
Common Uses for Input Enabled Formulas
  • Use Input Enabled formulas to enable or disable field input based on the value of another field.
  • Use Input Enabled formulas to enable or disable field input based on the role of the user in an application.


For Notes Client only
Input Enabled is Not Available for Web Browsers


This feature will only work in the Notes 6 (and newer) client. It will not work in a web browser client or Notes 5 or earlier clients.



Note
Field Style must be set to Native OS for Notes 6

Even though the Input Enabled appears for all fields, it only works for text, number, names, readers, and authors fields. The style of the field MUST be set to Native OS as shown in the following image:





Tip
Notes 7 Expands the Use of Input Enabled

The Notes 7 client expands upon the use of the Input Enabled to allow the control of editing of any field, regardless of type. Any display style can be used.



Demonstration
Demonstration of Input Enabled Formulas

The attached Database has a demonstration of the Input Enabled Formulas.

  1. Detach the following Notes database to your Notes Data directory.

    Inputen.nsf
  2. Open this database using File | Database | Open.
  3. Create a new document by using the Action at the top of the view.


  4. Enter information in the fields and click on the Action to Lock the Input Enabled fields.


  5. Notice what fields can be changed and which fields can not be edited?
  6. Use the Unlock Enabled Fields Action to allow editing to all the fields.
  7. Continue with this lesson.


Input Enabled Demonstration Explanation

The fields in the demonstration all have the Input Enabled event as follows. It simply refers to a number field called input. You can have any formula you want, just remember, set the formula to return False (a numeric 0) to block editing. Any other value will allow the field to be edited:





The action in the demonstration to disable the fields from being edited has the following formula. The first part of the formula is simply to ensure the document is in edit mode. The input field is changed to False (0) using the @False formula in line 5.


1.

@If(!@IsDocBeingEdited;

2.

@Do(@Prompt([Ok];"Warning";"The document is not in edit mode, it will be put into edit mode once you click OK.");

3.

@Command([EditDocument];"1"));

4.

"");

5.

FIELD input:= @False;

6.

@Command([FileSave])