Solved

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

Posted on 2010-09-22
14
1,753 Views
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?
0
Comment
Question by:dominoPgr
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 17

Expert Comment

by:fgrushevsky
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
0
 

Author Comment

by:dominoPgr
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.
0
 
LVL 5

Accepted Solution

by:
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
0
 
LVL 3

Expert Comment

by:jjphardy
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
  thisUI.GotoNextField
 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.
0
 

Author Comment

by:dominoPgr
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?
0
 
LVL 5

Expert Comment

by:iPinky
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..
0
 
LVL 5

Expert Comment

by:iPinky
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)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:dominoPgr
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?
0
 
LVL 5

Expert Comment

by:iPinky
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
0
 
LVL 3

Expert Comment

by:jjphardy
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.
0
 
LVL 5

Expert Comment

by:iPinky
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
0
 

Author Comment

by:dominoPgr
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
Computed when composed
Computed for display
Which one should I choose?
0
 

Author Comment

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

Author Closing Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now