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.

USER FEEDBACK TO THIS TIP

  • 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
    
    <style>
    .cDisabled{
    	border-width: 0px
    }
    </style>
    
    
    Full HTML Example
    
    <html>
    <head>
    	<title>DISABLED Demo</title>
    <style>
    .cDisabled{
    	border-width: 0px
    }
    </style>
    </head>
    
    <body>
    <form>
    Editable Field
    <br>
    <input type="Text" name="Field1" value="Edit Me">
    <br><br><br>
    DISABLED Field
    <br>
    <input type="Text" name="Field2" value="Disabled" DISABLED class="cDisabled">
    </form>
    </body>
    </html>
    

    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
This was first published in January 2002

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close