Custom Field - Date Validation rules

  • cpaschen
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 11 months ago #144249 by cpaschen
Custom Field - Date Validation rules was created by cpaschen
Is there any documentation related to the format of the Validation Rules or Server Validation Rules for Date Fields?

Specifically I need to set that the date must be more than 13 years ago (for a date-of-birth field).
I've selected Data Type Validation: Past Date, and it results in this:

validate[required,custom[date],past[2021-05-14]]

I set that field on 5/14, so it appears that this is a static date rule.
We need the ability to have it always check for '13 years ago' for the current date.

Is this possible with the validation rule.

I couldn't find any documentation specifically for Data Validation.

Does anyone else know how this works with some syntax examples?

Please Log in or Create an account to join the conversation.

More
2 years 11 months ago #144257 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom Field - Date Validation rules
Hello

Better use server validation rule. Set it to age:13 and it should work, I think

Tuan

Please Log in or Create an account to join the conversation.

  • cpaschen
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 years 10 months ago #144374 by cpaschen
Replied by cpaschen on topic Custom Field - Date Validation rules
Thanks. "age:13" does work for server-side validation; however, we would like to be able to validate this (and possibly other fields) within the browser.

Is there no documentation for this validation code? Are you using a standard library for validation, etc?

Please Log in or Create an account to join the conversation.

More
2 years 10 months ago #144389 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Custom Field - Date Validation rules
Hello

We use jQuery validation engine for client side validation, but it does not support that rule, sorry. See github.com/posabsolute/jQuery-Validation-Engine

For server side validation, we use this library github.com/vlucas/valitron

(The age validation rule is added by us as the rule is not available in the original package)

Tuan

Please Log in or Create an account to join the conversation.