3 Replies Latest reply on Feb 12, 2015 10:23 PM by philmodjunk

    Skip date validation?

    gremlin9297

      Title

      Skip date validation?

      Post

      Okay so im hoping there is any solution to this questions. I have a field set for entering dates. Works just like it should... until I enter a date that doesn't contain a day. The problem is that not every dater I enter is a full date, sometimes the dates only contain a month and year, no day. I would like it to format it for dates when full dates are entered, but if the day is missing then have the date entered still be allowed and not kicked out due to validation. I'm thinking I may have to change this from a date field to calculation field, though thought I'd ask for some suggestions if there is any easier way.

      Thanks,

      Eric

        • 1. Re: Skip date validation?
          philmodjunk

          All fields of type date must have a day specified. That's because the date is stored internally as an integer recording the number of days from 12/31/0000 to the date you entered. Without a day, there's not enough info for FileMaker to compute that value.

          What you can do, is set up the OnObjectValidate trigger to run a script that checks the data in this field before FileMaker can try to validate it as a date. If a day has not been specified, the script can modify the text entered to supply a default day such as 1 to create a date that won't trip this validation error.

          • 2. Re: Skip date validation?
            gremlin9297

            If I did that wouldn't the script then add a day to make it valid then? Or would the script just be tricking the validation system letting it believe that there was a day while the field reflected just the month and year? If so what would the script look like?

            • 3. Re: Skip date validation?
              philmodjunk

              Yes, it adds a day to the date. As I stated in my last post:

              the script can modify the text entered to supply a default day such as 1 to create a date that won't trip this validation error.