There are many ways to do this. Here's an often-used method that I usually prefer.
Place the fields that you want to be conditionally editable inside of an access-controlled section. The section editors formula can use the fields on the form and information about the user to calculate whether the person viewing the document is allowed to edit the document.
For instance, let's suppose that you want to only allow the user who submitted the form to edit these fields, and then only until the form is submitted. You have a field named Submitter, Computed When Composed that contains the Notes name of the user who composed the form (formula: @UserName). Another field, Status, tells whether the document has been submitted or approved. It has four possible values: Draft, Submitted, Approved or Rejected. If the form is in Draft or Rejected status, the submitting user may edit the fields; if not, no one may edit them.
In this case, you could select the type of the section editors formula as "Computed for display" so that it will be recalculated every time the document is opened. The formula could be:
@If(Status = "Draft" : "Rejected"; Submitter; "-nobody-")In other words, if the status is Draft or Rejected, the person whose name is in the Submitter field may exit here; otherwise, nobody can. (There is nothing special about the value
-nobody--- you can use any string that you know doesn't match the name of any user or group). If the formula returns "" or "*", anybody can edit that section.
Section editor formulas often return a role name such as
"[Admin]" instead of or in addition to a username. Remember if you are using multiple values, to create a list using the ":" operator, not "+". For example:
Submitter : "[Admin]"not
Submitter + "[Admin]"to allow the submitter and everyone in the [Admin] role to edit.
One caveat: Controlled access sections are not a security feature. A determined and knowledgeable user can change the value of any field in any document that they have access to edit. If you need to be certain that only certain users can change the document, use Authors fields to limit access to certain users.
If you don't want the expand/collapse the functionality of a section, set the section to be expanded in all modes, and use the hide tab of the section properties to hide the section header. This has the effect of locking it open. (The hide properties in the section dialog apply only to the header line, not to the section contents, but if the header is hidden the user has no way to open the section.)
Do you have comments on this Ask the Expert Q&A? Let us know.
This was first published in April 2004