Form Date Validation

Olivier Cozette asked on December 2, 2014 16:51

I need to validate a date input on my Kentico form: Kentico allows to 'hardcode' a "From" and a "To" date value, but what if I need to validate if the user date input is between 100 and 110 days old, comparing it against TODAY ? Is there a way using a macro (or anything else) to validate dynamic dates input ?

ex: FROM -> (Now()-110) TO -> (Now()-100)

Recent Answers


Brenden Kehren answered on December 4, 2014 05:54

I'd think you might be able to use a macro like this ToSystemDateTime(From.Value).Between(DateTime.Now.AddDays(-110), DateTime.Now.AddDays(-100)) in a validation rule for that field. If not, then maybe some a custom event handler, custom macro or some javascript/jQuery would work better?

1 votesVote for this answer Mark as a Correct answer

Olivier Cozette answered on December 5, 2014 05:54

Thank you BRENDEN, I'll try it tomorrow and get back to you.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.