Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Disable input for certain fields based on criteria

Posted on 2004-10-26
20
Medium Priority
?
347 Views
Last Modified: 2013-12-18
Hi experts,

I've got a form that contains many combobox fields and I want to disable certain fields from being editable when the current user is not the creator.
The criteria to check whether the fields should be enabled is based on the comparison of 2 computed fields. I've managed to do it for the web using javascript using these codes in the onLoad event:
if(document.forms[0].authUser.value != document.forms[0].lName.value)
{
      document.forms[0].UserName.disabled = true;
      document.forms[0].Company.disabled = true;
      document.forms[0].Department.disabled = true;
      document.forms[0].probCategory.disabled = true;
      document.forms[0].probDesc.disabled = true;
}
This works fine for the web but in the notes client it does not work so I hope someone can help by providing a lotusscript or formula version of my current JS codes. (I dont know what is the field property in LS that controls editability)

I've tried using:
authUser = lName
in the Input Enabled of the fields but still doesnt work. I've also tried using the Javascript in client but doesnt work too.

Thats all! Thanks in advance for any help.



Regards,
zZR
0
Comment
Question by:lianaizhouzhiruo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +3
20 Comments
 
LVL 19

Expert Comment

by:madheeswar
ID: 12408537
u need to use Controlled sections for this.
This wil work both on Notes and Web.

See Help for more details.
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12408550
Is it R6 ?  Then there is a new field property available you can use.

cheers,

Tom
0
 

Author Comment

by:lianaizhouzhiruo
ID: 12408628
Hi Madheeswar, my fields are laid out in different places so I cant use controlled sections. Is there any other way?

Hi Tom, my designer is r6 but i think the server is on r5. Anyway what is this new field property?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12408669
You could use the "old-fashioned" way: have two fields adjacent to each other, make one editable and the other computed for display, with a formula that has only the name of the first field in it. Give both fields a hide-when formula, the first field must be shown when the creator (or someone with a [Manager] role?) is editing the form, the second when it's someone else. To prevent some comments from my colleagues ;), you can replace the computed for display field with computed text with the same formula.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12408675
Create for every field that you want to be able to disable editiong also a read-only version.
For example for Department field add the field dspDepartment.
Now the field Department has hide-when set for Readers, and the field dspDepartment has hide-when set for editors.
The value for the dspDepartment field is simply: Department
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12408684
Is that old-fashioned?
Now I am too long out of business :(
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12408724
If you are on an R5 server, I wouldn't use it, but here is how you use it :

It's the Input Enabled fieldproperty (it's there together with Input Validation etc.).  Put this in (as an example):

@If(@ThisValue="";@True;@False)

This will set the field enabled for input if it's empty, but once it has a value, the field will be disabled for input.

cheers,

Tom

0
 

Author Comment

by:lianaizhouzhiruo
ID: 12408848
Hmm, I tried bosman/zvonko's method and it works for most of the fields except a Rich text field. Is there any way to make this RTF uneditable except by the creator?

I tried that and it didnt work Tom thanks though.
0
 

Author Comment

by:lianaizhouzhiruo
ID: 12408874
BTW, the hidewhen formula didnt seem to work for the RTF
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 12408956
You have a typo in the hidewhen.
Hidewhen work also for RTF.

Do you realy need Rich Text or do you use it only because of rows and columns in <textarea>?

0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12408978
For richtext, the new method doesn't work, but it certainly works for ordinary fields (since I use it myself).

To recalculate the enable/disable, you do have to use F9 (to refresh the document) in this example case.

You can hide richtext, if you use a simple trick : put it in a table or put text in front of the field and behind, and hide that text.  That will hide your richtextfield too.

cheers,

Tom
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 12409037
Hiding a RTF I usually do differently, but hey, don't we develop or own methodsm constantly?

I used to do the following:
- put the RTF in a subform
- add a computed subform to the form
- formula like: @If(mustbevisible; "subformname"; "")

But maybe Tom's trick is shorter. Hiding RTF's is more difficult, since you can use hide-whens INSIDE a richtext field!
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 12411417
Has nothing to do with R5 server or R6 server... it depends on whether you users all hae R6 clients or not.  Same as if you had a bunch of users who have old versions of Navigator that don't have the support for .disabled.

If all users will be sing this on the server, not rpelicated locally, the following will work:

1) Select the fields that you wish to disable
2) Create->Section->Access Controlled
3) Specify computed for display
4) FOrmula is: @Name([Canonicalize]; authoName)
0
 
LVL 31

Accepted Solution

by:
qwaletee earned 280 total points
ID: 12411456
And, you CAN use access controlled section even with disperesed fields.  Yu don't want it to look messy, so here's how:

1) Do the above steps separately for each field
2) For each section, go to section properties, hide-when, and check off both Notes and Web

Now, the section chrome is hidden, leaving just the field visible -- but the section "security" still applies, and the section conetnt isn't hidden, just the section UI
0
 

Author Comment

by:lianaizhouzhiruo
ID: 12418884
Hi people thanks loads for all the replies. I'll be back at the PC tomorrow to try these out! Will check back in 24hours


Cheers!
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12418896
Qwaletee, although using R6 functions in an R6 client is possible on an R5 server, I still wouldn't use them - there is also a webinterface here, which means on server, hence 'R5 ONLY'

cheers,

Tom
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 12424880
Yes, but these attributes are only used in the Notes client part of the form.  The web server will ignore form attributes and field attributes that it does not know about, much as Hide From Notes 4.6 would not break an app on a 4.5 server.  For that matter, Hide From Web would be ignored on the 4.5 server, so thae page would dispay, although not what you expect in that case
0
 

Author Comment

by:lianaizhouzhiruo
ID: 12429307
Hi Qwaletee,

Tried your method and it works fine in Notes(section arrows dont appear, which is great).
On web however, when the document is opened for reading, the fields are totally empty. And when I open the document for editing, the fields are totally editable even though they shouldnt be.
0
 

Author Comment

by:lianaizhouzhiruo
ID: 12429448
Just in case I wasn't clear enough, on the web the whole section and the field that it controls is not visible when document is opened for reading but when opened for editing, the fields appear without the section arrow.
0
 

Author Comment

by:lianaizhouzhiruo
ID: 12430210
I kept the sections and got over the problems for the moment by creating duplicate fields that are hidden from notes and when opened for editing with default value formula of the original fields.
Hope to hear other solutions soon


Cheers!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
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.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

604 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