Solved

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

Posted on 2010-09-22
14
1,743 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
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
Comment Utility
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
Comment Utility
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:dominoPgr
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Actually, type Computed worked for me. Thanks!
0
 

Author Closing Comment

by:dominoPgr
Comment Utility
It worked for me. Thanks a lot!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

9 Experts available now in Live!

Get 1:1 Help Now