form date time validation

lawrence whittemore asked on March 30, 2020 16:49

Is it possible to use the date and time validation to make sure the date being entered is earlier then the current date? This way users can only enter past dates?

Recent Answers


Dmitry Bastron answered on March 30, 2020 17:15

Hi Lawrence,

What version of Kentico are you using? Is it Portal Engine or MVC? Is it a frontend form via Form Builder or you need to restrict this in Kentico admin for page type field, for example?

0 votesVote for this answer Mark as a Correct answer

lawrence whittemore answered on March 30, 2020 19:41

kentico 11 in portal mode. In the formbuilder for a front end form. I see I can set validation on the field but it makes me specify a date, I was wondering if there was a custom validation I could add that would do the trick.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on March 30, 2020 21:44

That should be fairly simple, use the following General condition (from the validation rules type dropdown):

Value < DateTime.Now

You can use any K# macro there to build a bit more complicated rules if needed.

0 votesVote for this answer Mark as a Correct answer

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