Hiding a rich text field
Tue 24 Aug 2004, 11:12 AMTweet
by Ben Langhinrichs
Copyright © 2004 Genii Software Ltd.
What has been said:
203.1. Stephen Hood (08/25/2004 07:28 AM)
What are the kinds of problems with RT on subforms you are aware of? Currently have an app using such an approach and would like to know if I'm walking into problems down the road..Currently the RT's are all inside sections and the subform is placed inside a table on the main form.
Thanks for the tip.
I had been avoiding the hiding of RT because of these issues but I think I'm covered now because of the way it's already structured. Now if there was a way of determining a RT is blank from a formula...
203.2. Michael Woehrer (28.08.2004 11:05)
Interesting blog entry...
I don't know if it was already mentioned here in this Blog, but another question which comes up on many forum is: "How to prohibit editing rich text fields".
I know 3 workarounds to realize this:
1) Using the entering event, e.g. uidoc.gotofield("Subject")
2) Using a subform
3) Using a controlled access section
I preferred (1) so far, although it is not perfect and imho a stinky workaround.
203.3. Ben Langhinrichs (08/30/2004 07:39 AM)
As a matter of fact, that has been covered recently. I was trying to remember where, but here is the post: Rocky's workaround
203.4. Esmond (01/06/2005 08:28 AM)
Good Tip Ben, Thanks alot!
One thing I picked up through some experimentation... The section's hide-when formula seems to only apply to the RT field it contains, If the section is [b]collapsed[/b] when the form is saved. So if you save the form with the section expanded, the RT field will show no matter what. Similarly, setting a section to autoexpand will also defeat the section's hide-when.
203.5. Andre Guirard (06/05/2006 06:25 AM)
If you use a controlled access section with a hidden header line, you can set the section to auto-open for editors and auto-close for non-editors. Then, write a CFD section editor formula that decides who may edit the section, which uses @UserName as its return value if the rich text should be visible. E.g. to hide when Status = "Approved":
@If(Status != "Approved"; @Username; "-nobody-")
203.6. Ben Langhinrichs (06/05/2006 06:38 AM)
Andre - That sounds like a good plan. I'll give that a try as well.
203.7. Trapti (03/28/2007 12:29 AM)
Thats a useful and indepth information about hidewhence on Rich text fields
203.8. Prem (02/21/2008 01:54 PM)
I tried all the options, but it didn't work as expected. I display rtf and label based on radio button selection. The only problem I'm facing is, if I attach a document to rtf and decide to select some other option, even then label part disappears. The hide when formula is as follows
Business != "Option1" & rtffield = "".
But when the document is saved, then the label part works as per formula. Any means of knowing if rtf is blank or not without saving.
203.9. Sreekanth (05/21/2008 10:06 AM)
Ben.. its very good information about Hiding RT .....gr8
203.10. Dan G (09/23/2008 09:42 AM)
Thanks Ben! Works like a champ. (your former associate @JDRP 96)
203.11. Philippe Duvivier (11/05/2009 15:37)
I tried all the options suggested here, which are good workaround, but found another way which also seems to work and is somewhat more simple: I have put the RTF field in a 2 rows table with the options "Show only one row at a time" and "Switch rows programmatically". So you can show either an empty row or the row containing the RTF field. The only restriction is that, as the RTF is in a table, the Paragraph Styles cannot be used (which is another bizarre and annoying restriction of RTF fields).
203.12. venkat (01/18/2010 05:21 AM)
Hi i am new to lotus notes. Can you please explain how to restrict editing the rich text field using subform as mentioned above. Also it should show the attachments in the rich text field.