Jump to content
Server Maintenance This Week. ×

range of dates field


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

Recommended Posts

Hello!

I have two Date fields in my database, Date1 and Date2, that allow someone creating a new record, or searching for a record, to put a date in Date Field 1 and another, later, date in Date Field 2, so expressing a range of dates. The Date2 field can be left blank, it can be the same as Date1, it can be later than Date1, but it should never be earlier than Date1, so I want to build in a way to either stop the user from entering an earlier date in the Date2 field, or to at least warn them that they need to reenter the date correctly. I tried using Validate/Calculate and thought that might work, but it brings up a Revert Record message when the user makes a mistake, that I don't really want to happen.

Is there a different approach that someone can recommend? I saw some reference to a piece of code called ObjectValidate or something like that, but have not found that value when I go into the Scriptmaking space.

Thanks for any advice you  might have!

Jennifer

Link to comment
Share on other sites

1 hour ago, JenAAAA said:

I saw some reference to a piece of code called ObjectValidate or something like that, but have not found that value when I go into the Scriptmaking space.

I believe this refers to a script triggered by an OnObjectValidate event:
https://fmhelp.filemaker.com/help/18/fmp/en/index.html#page/FMP_Help%2Fonobjectvalidate.html%23

If you attach such script trigger to the field's instance on a layout, the script will run before the field is validated, allowing you to interact with the user using a custom dialog or a new window before (or instead) of the validation error message..

If the constrain is critical, I would still keep the validation in place. Script triggers work only on the layouts where they have been installed. Field validation works at the data level.

 

Link to comment
Share on other sites

This topic is 1487 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.