fmbug Posted August 9, 2011 Posted August 9, 2011 hi everyone....please help me in a situation: how i can remove browse mode from a field through script.?
David Jondreau Posted August 9, 2011 Posted August 9, 2011 Could you explain what you're trying to accomplish? I ask because you don't need a script to prevent someone from entering a field in Browse mode. It's a setting you can choose in the Inspector.
fmbug Posted August 17, 2011 Author Posted August 17, 2011 Actually scenario is: we are entering the detail information of a company and an individual. when any body choose company through checkbox, then the fields regarding information of an individual should become non-editable. such as: Name: --n/a--
Fitch Posted August 17, 2011 Posted August 17, 2011 There are a few ways you might accomplish that, none I would call extremely elegant. One way that wouldn't be too unreasonable is to make a tab object with 2 tabs. Give each tab an object name using the inspector, e.g. "edit" and "locked". On one tab, place the editable fields, and on the other place a copy of the fields, and use the inspector to disable entry in browse mode as David suggests. You can then hide the tabs by setting their label and line width to zero. Now create a script that goes to the appropriate tab based on the company checkbox, and set it as a script trigger on that field.
David Jondreau Posted August 17, 2011 Posted August 17, 2011 I'd probably go with an OnFieldEntry script trigger. I have a generic one I can use on all fields. This is the basic script: Commit ( locked ) # This script will commit a record when the parameter is true. Allow User Abort [ Off ] If [Get ( ScriptParameter)] Commit Record[] End If Assign that script to an OnObjectEntry trigger and pass a parameter that's testing whether a company has been chosen ( i.e. not isEmpty ( _fk Company ID ) ). That's stop the entry. If you want some indicator of whether it's editable, I'd use conditional formatting to make the field fill gray based on the same criteria you're passing to the script.
LaRetta Posted August 17, 2011 Posted August 17, 2011 This is what I do as well, David, except I use Go To Object [ dummy ] where dummy is any text object. We frequently use text objects for declaring variables and they ride at the top of layouts and only display in layout mode using conditional formatting: Get ( WindowMode ) < 4 with font set to 500. I prefer Go To Object [ dummy ] because it does not commit the record. Go to dummy works for other occasions as well. :^)
Fitch Posted August 17, 2011 Posted August 17, 2011 Nice solution, David -- and you can apply the script trigger to multiple fields at once. I agree with LaRetta, I wouldn't necessarily commit the record.
Recommended Posts
This topic is 4844 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now