How to lock a Rich Text field after click a button from a Lotus Note document?

Posted on 2010-09-22
Last Modified: 2013-12-18
For any other field type (not rich text field), I can use following solution from my previouds question:
 The easiest way to do it to have two fields for each field that you want to lock, for example Field1 and Field1_R
Field1 would be your editable field
Field1_R would be computed for display (i.e. read only) field with the formula Field1

When user clicks on the button, the button would set a flag , i.e. some hidden field. You will use this flag field in the "hide when formula is true" formula to hide FIELD1 and display FIELD1_R instead.

this is how it works:
user opened a document
Flag_Field="0"  (default value)

FIELD1 is visible (hide when formula is ... Flag_Field="1")
FIELD1_R is not visible (hide when formula is ... Flag_Field="0")

user click on a button that set Flag_Field="1"

FIELD1 is not visible (hide when formula is ... Flag_Field="1")
FIELD1_R is visible (hide when formula is ... Flag_Field="0")

However, above approach does not work for Rich Text field. How can I lock(change to uneditable) a Rich Text field after click a button?
Question by:dominoPgr
  • 6
  • 5
  • 2
  • +1
LVL 17

Expert Comment

ID: 33736778
the rich text field is a bit more trickier

you can put FIELD1  and FIELD1_R  into different sections and hide them depending on the flag or  put fiels into different subforms and display them depending on the flag as it was suggested

Author Comment

ID: 33738132
I'm new to lotus notes development. Still trying to understand how can I sync the value between FIELD1 and FIELD1_R after FIELD1 is being edited? For rich text field, we don't have "Computed for Display" field type. I can only set it as "Computed". After I added FIELD1_R as Computed field, and set it's value as FIELD1, the first time I open the documant I see FIELD1_R has got the same value of FIELD1. However, after I edited FIELD1, and save the document, Field1_R is not being updated.

Accepted Solution

iPinky earned 250 total points
ID: 33741173
you could (depending on the layout) put an access controlled section around the richtext field.

make the formula such that upon Flag_Field = "0" the access formula is "*" and otherwise "[Designer]:[Admin]"

eg.: formula for access controlled section:

@if( "0" = Flag_Field; "*"; "[Designer]:[Admin]" );

this would effectively only give users with role Designer or Admin edit access to that field.

the only drawback is that this process only works after "reopening" the document, but this can easily be handled in your button as well
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.


Expert Comment

ID: 33746062

This is one of the big holes in Lotus. There is no effective way to do this without closing and reopening the doc. The closest I have come to this is by using the "Entering" event.
Something like this
Sub Entering(Source As Field)
 Dim ws As New NotesUIWorkspace
 Dim thisUI As NotesUIDocument
 Set thisUI=ws.CurrentDocument
 If thisUI.FieldGetText ("flagfield") ="jumpval" Then
 End If
End Sub
This is untested code and mostly done from memory. It is placed in the "Entering" event of the field.  
flagfield is the name of a field that is set to "jumpval" when you want to lock down this field. There must be an editable field after your richText field.
This can not be written in formula. It is not available for this event. It can be done in the onFocus event also but I have not tried it here.

Author Comment

ID: 33748490
I like the idea of using Access Controled Section as I have 20+ fields to work with.

However, when I tried to put some fields in access controled section, all fields becomes un-editable even my Flag_Field is 0. Is following formula correct for setting Editable?
@if( "0" = Flag_Field; "*"; "[Designer]:[Admin]" );

Is "*" for every one to have edit access?

Expert Comment

ID: 33748498
jjphardy… I honestly hope this piece of code is not implemented in your applications.

It is NEVER a good idea to work with uiDocument.FieldGetText( "" ).. it's slow and ALWAYS returns text, even when the value is date or number, or error.

big hole? a hole to me is something bad in security, but this ain't related to security at all..

Expert Comment

ID: 33748692
yes "*" is for everyone, I guess you need to put the formula the other way.. sorry I didn't check it really..

i usually call such fields: Flag_Hide then a "0" would mean no hide,

so I guess @if( "1" = Flag_Field; "*"; "[Designer]:[Admin]" ); would be correct.
the Flag_Field (usually for such fields) is supposed to go on top of the page and "hidden" always (I usually use a "style" which hides and makes hidden text red (or any other color to identify easily)

withIN the access controlled section you would ONLY put the RichText fields! but you can create an access controlled section for each richtext field (if they are scattered on the form, eg. you can even use access controlled sections within a table)

Author Comment

ID: 33775788
Sorry for the late response. My access controlled section is still not working right. I got all fields in the access controlled section editable. But after I changed the Flag_Field from a button click, the fields are still editable.

I'm using Lotus Notes version 7. Which LN version are you using?

Expert Comment

ID: 33786020
you need to close and reopen the document, otherwise something with your formulas is wrong, maybe you post the db and I have a look

Expert Comment

ID: 33789865
The security of a section does not override the ACL. Just like an editors field. If the ACL grants you Editor, or above, you can edit the doc or section. Does not matter what is in the list.
If you are testing this from the same ID you are designing from, you can not lock yourself out.

Expert Comment

ID: 33790031
sorry jiphardy.. that's absolutely not true..

a simple test would have proven that this ain't correct...

it is "finegraining" the ACL... same as reader fields..

if there is a reader field and you are not part of it.. even Manager access to the DB won't make the document visible to you!

and that's exactly how it's supposed to work

but as I said: a reopen of the document is required after setting the flag field

Author Comment

ID: 33794070
I found what caused by problem: In the Type field above the Access Formula, I chose Editable which is wrong. I still have a few other choices:
Computed when composed
Computed for display
Which one should I choose?

Author Comment

ID: 33794136
Actually, type Computed worked for me. Thanks!

Author Closing Comment

ID: 33794149
It worked for me. Thanks a lot!

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Notes 8.5.2 application on web 4 215
How to add a username for multiple users in Lotus 6 117
@ command if structure getting unmanageable 12 100
Code for extraction to mkdir folder 5 73
For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question