AnsweredAssumed Answered

FMS with PHP Enable Record Data Pre-validation Rejects All Valid Dates

Question asked by tduell_1 on Aug 7, 2012

Summary

FMS with PHP Enable Record Data Pre-validation Rejects All Valid Dates

Product

FileMaker Server

Version

12.0

Operating system version

OS X or Windows

Description of the issue

If you enable record data pre-validation on FMS and choose strict data type 4-digit year date for the field validation it will reject all valid dates when submitting a date through a web form.

Steps to reproduce the problem

1. Turn on enable record data pre-validation on FMS.
2. Check the box for strict data type 4-digit year date for the date field in the database.
3. Create a web form with PHP that will submit a date field to the database. When you edit the record, make sure the code uses the following code sample to force the record pre-validation to run on the web server before the data is committed to the database and the code is executed:

$result = $edit->validate();

Then execute the request.

Expected result

If the date is correct, such as 8/7/2012 it should update the records correctly. If the date is incorrect, such as 2/31/2010, it should throw an error because that is not a valid date.

Actual result

No matter what date you use, it throws an error. This has been a known problem with pre-validation since FileMaker Server 10 and it is still present in FileMaker Server 12!

Exact text of any error message(s) that appear

When I trap for errors it returns error # 4 for the date field:

Validation Failed
Number of Errors: 1
Field Name: Date, Error Code: 4, Value: 8/7/2012

As you can see, 8/7/2012 is a valid date!

Workaround

There is no work around for this bug. You should pre-validate any data entry using PHP rather than relying upon FMS.

Outcomes