Manage Learn to apply best practices and optimize your operations.

Never Use Computed for Display Fields Again!

This tip disables any fields or buttons on your form.

You Can View User Feedback To This Tip

This tip disables any fields or buttons on your form.

Developers have always had this problem of having to use computed for display fields for their corresponding editable fields. Suppose I do not want to use author fields, my default access is "Editor" and want that certain people should not be able to change certain field values at a particular status in the workflow. At the same time I want the user to be able to enter data in some other fields and click on certain buttons only. In Notes I would use controlled access sections. On the web, we all know how controlled access sections look like! So we tend to use computed for display fields showing the value of the original editable field so that the user does not change any specific data. Instead, wouldn't it be nice if we could just DISABLE the editable fields or buttons on that particular status, so that information was for read-only purposes only. Well, try this:

(1) In the <HTML> Tab of your field/button enter a 'Name' in the 
Name field. Let's sat 'TestName' (2) Use the folowing code: document.forms[0].TestName.disabled = true This will disable that element on the form. (3) To enable, you simply say: document.forms[0].TestName.disabled = false. This way you can disable/enable fields/buttons etc... on your form.


  • Further to this tip, which is very useful at times and certainly reduces development time/Fields....

    You can also just Compute the word "DISABLED" into the HTML Attributes of the field. This code can then made more flexible/powerful by the use of @Formulae.....

    Code: If you want a field to only be editable by users with the Admin Roles then you can do this...

    In the HTML attributes section of the field... @If(@IsMember("[Admin]"; @UserRoles); ""; "DISABLED")

    The disabled field I have found can be confusing to users as they see a field but do not understand why they can't edit it. So I compromised by using a stylesheet to highlight the fields which are DISABLED - you can compute the HTML attributes to contain the class name "cDisabled" and control the look fo the field - here is an example..

    @If(@IsMember("[Admin]"; @UserRoles); ""; "DISABLED class="cDisabled"")
    and in the HTMLHEAD (or as passthru on the form) you can add
    	border-width: 0px
    Full HTML Example
    	<title>DISABLED Demo</title>
    	border-width: 0px
    Editable Field
    <input type="Text" name="Field1" value="Edit Me">
    DISABLED Field
    <input type="Text" name="Field2" value="Disabled" DISABLED class="cDisabled">

    The MAJOR drawback for this method is that the DISABLED Tag (and the style sheet for that matter) is not supported in Netscape4 (works in Netscape 6.1) and any user can bypass the security by just using the netscape 4 browser...
    —Mark Roden

  • This tip isn't bad at all. If the user tries to use an older version of Netscape, you can simply us the blur property once you check if a version of Netscape is less than 6.1—Yoofi Ocran

Dig Deeper on Lotus Notes Domino Administration Tools

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...