3 Replies Latest reply on Oct 9, 2010 5:04 AM by LaRetta_1

    Can Script Trigger to Block Entry to Field?

    KenS

      Title

      Can Script Trigger to Block Entry to Field?

      Post

      How can I block a user from filling in a text field on a portal line?

      I have a text field that is only applicable to some lines of a portal. I would like to keep the user out of the field for the other lines, e.g. I dont want to let them erroneously fill it in where it is irrelevant. I thought to use the OnObjecrtEnter script trigger, which fires at the right time, but I cant seem to make it abort the entry into the field. Am I on the right track or is there some other way to keep the user out of the field?

      Thanks

        • 1. Re: Can Script Trigger to Block Entry to Field?
          philmodjunk

          In the Inspector, on the Data tab, there's a section labeled behavior where you can block access to a field for all users by clearing at least the "browse" check box.

          In your triggered script, you can use go to field or go to object to move the cursor out of the field to a different objet if you want it accessible to some users and not others.

          • 2. Re: Can Script Trigger to Block Entry to Field?
            KenS

            Thanks Phil. I also discovered that if OnObjectEnter trigger script does a Commit and Exit False the field is left unentered.

            • 3. Re: Can Script Trigger to Block Entry to Field?
              LaRetta_1

              Similarly, Ken,  I prefer script called TRG: noFieldEntry [ flag ] with: 

              If [ Get ( scriptParameter ) ]
              Go To Object [ “Dummy” ]
              End If

              Why?  Because I don’t want to commit the record.  I also want generic script which can work for all fields;  I simply set the Boolean test as the parameter on each field.  If true, it disallows entry.  In this way, you don’t have to turn off entry to the field and then script when it can be entered. 

              What is the Dummy?   I chose an object which always exists on my layouts – an “I declare variables” text object.  It can be a company logo, a header line … anything static.

              Keep in mind that, if the control should work on the field no matter the layout and the only TRUE way to protect data, is by using Security (what used to be called Accounts & Privileges).