Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7059 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all, I'm relatively new to FMP7 and building my first solution. I'm wondering if there's a way to lock a field (from edit) based on some condition. I have a field in my main table, "grade", that should be locked based on a date range of two global fields in my user interface table.

I have the global fields "grade_begin_dt" and "grade_end_dt" set to the date range when the field "grade" should be open. If the current date is outside of that range, I want to lock the "grade" field and prevent any edits.

Any thoughts appreciated!

-Heather

Posted

Unfortunately Filemaker does not allow you to change the properties of a field in this way. You could create two layouts, one with the field open another with it locked, then go to a specific layout based on your grade_... fields. Or you could use validation to pop-up an annoying error message telling the user they can not enter a grade because the current date doesn't fall between the specified range. You also might try making the field a button to run a script that would enter the field (go to field) if the current date was in range or if not in range show a message then go to previous field.

Posted

While you may not be able to lock the field conditionally, you can use a field validation calculation to prevent users from saving changes.

Get ( CurrentDate ) >= grade_begin_dt and Get ( CurrentDate ) <= grade_end_dt

Be sure to display a custom message to let the user know why s/he cannot save the change.

Posted

I had already stated that... "Or you could use validation to pop-up an annoying error message telling the user they can not enter a grade because the current date doesn't fall between the specified range".

Filemaker does not offer much control to the programmer when validation fails and the Revert or OK process cant get very annoying. In this particular case validation is a poor work around. The programmer doesnt want to validate the data in the field, they want the field to be disabled if a certain condition is not met. Unfortunately you can not easily Enable or Disable a field at Run Time and you can not test a condition when a field gains focus.

  • 3 months later...
Posted

A neat (if weird) trick I often use to adjust the user interface dynamically without needing extra layouts is to have a portal to a utility table with one record whose whole purpose is to show or hide interface elements. Have a calculation field (it doesn't matter if it's stored or unstored or global or nonglobal) in the layout's table set itself to "Yes" when you want to display an element and "No" when you want it to be hidden. Have your Utility table contain an indexed, stored nonglobal calculation field which is the constant "Yes". Create a relationship from the Yes/No field of the layout table to the Yes field on the utility table, and make a portal on that relationship, putting all the interface elements you want to show/hide inside the portal.

It's a counterintuitive hack, and it means you'll sometimes have strange-looking blank spaces over your layouts where you hid something, but it sure beats creating 5 different layouts that are all minor variants of each other (maintenance nightmare!). I'm not sure the technique applies exactly to what you want now, but it's worth knowing at any rate.

This topic is 7059 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.