Empty date field in a form

Hi, creating a custom form and having trouble with the Datetime field type.


I need the field to be optional, but it returns a validation error. There doesn't appear to be an overall 'required' attribute for these fields. So, in the details screen I've checked it to 'allow blank' for all sub-fields. However, it still returns an error.

[quote]Hi, creating a custom form and having trouble with the Datetime field type.


I need the field to be optional, but it returns a validation error. There doesn't appear to be an overall 'required' attribute for these fields. So, in the details screen I've checked it to 'allow blank' for all sub-fields. However, it still returns an error.[/quote]

There is not currently a Simple Form Validation rule for DateTime fields, hence the absence of a "Required" field. However, setting up a field with "Allow Blank" as you have done should allow a blank date to be submitted.



Please provide further information regarding the error message displayed, any minimum / maximum / default settings on the field, and the version on which this is occurring.

[quote]There is not currently a Simple Form Validation rule for DateTime fields, hence the absence of a "Required" field. However, setting up a field with "Allow Blank" as you have done should allow a blank date to be submitted.


Please provide further information regarding the error message displayed, any minimum / maximum / default settings on the field, and the version on which this is occurring.[/quote]

Thanks - it could be due to a bug with the particular (old) matrix version 3.12.2 - we are about to upgrade!



I have since found that it allows me to leave the time fields blank but not the day, month or year.



The only min/max I've set is for the year field: 2008 minimum, 2028 maximum and 2008 default (though the default doesn't seem to work), but I've tried all manner of combinations without any change of behaviour.

3.12 had a datetime error bug on our installation. You should have that checked out or upgrade.


Quickfix is to issue dates on forms as text fields and use a jquery calendar?

[quote]Thanks - it could be due to a bug with the particular (old) matrix version 3.12.2 - we are about to upgrade!


I have since found that it allows me to leave the time fields blank but not the day, month or year.



The only min/max I've set is for the year field: 2008 minimum, 2028 maximum and 2008 default (though the default doesn't seem to work), but I've tried all manner of combinations without any change of behaviour.[/quote]

There were a number of issues related to date/time and defaults in Custom Form which have since been resolved.



Regarding the form, I would recommend keeping the year portion blank as a default in this instance, as the value "2008-- ::" will be submitted instead of a blank date/time value if the user proceeded with the form without changing this field. Year-only submission is fine in later versions, but might be causing the validation issue described in your current version.