How do I prevent a user from entering an invalid date format (i.e 22/34/2090) and restrict them from manually entering a date into date picker field in WFFM?

--> Whenever I submit the form with an invalid date format, I'm getting a loading symbol and I'm not able to submit the form.

enter image description here Screen shot of entered manually invalid date format

2 Answers 2


WFFM only supports client-side validation when using regular expression-based validation or otherwise native validations (updated 6/29). Custom validations beyond that is something that you need to add on your own. However, it does include native support for custom server-side validation (updated 6/29). From your description, it sounds like you have the server-side validation set up in Sitecore, but you are missing the client-side validation.

UPDATE 6/29: Clarifications, as requested

Re-reading this post, @jrap is correct that the wording was confusing. The following is meant to clarify the post.

WFFM does include client-side validation for its built-in form-specific, field-type validations (including the "Custom" validation) and required field validator. However, the use of these validations is somewhat limited, with the field-type validations applying to all fields of a particular type that use it and the form-specific validations being specific to a field but only supporting regular expressions. This means that if you have a more complex validation, e.g. checking to see if a chosen date is within a predefined range, then these validation features are somewhat limiting. In these cases, your best bet is often to write your own custom field-type validators. You can specify error messages and your logic, but you will still need to add your own custom client-side validation. This is because custom field-type validators are server-side and thus validation is only triggered when the form posts to the server. If the field is invalid then the form will display again with the necessary validations. However, client-side validation can be used here if you want to prevent the form from being submitted if invalid.

  • 1
    "WFFM does not include client-side validation". Is this specific to the date field? I know for sure that it supports client-side validation for many other fields. Please clarify your answer.
    – jrap
    Jun 29, 2017 at 11:25
  • @jrap thanks for pointing this out. This post definitely needed some elaboration and rewording. The key is that client-side validation is not included for non-native validations (custom regular expressions notwithstanding) Jun 29, 2017 at 14:41

WFFM has a validation type for dates: https://doc.sitecore.net/web_forms_for_marketers/working_with_actions_and_validations/validations/the_fieldtype_validations

In case that's not client-side you can build a regex via the DynamicRegularExpression attribute which are definetly client-side.

  • WFFM uses Jquery validation to be precise Jun 29, 2017 at 12:17
  • Without the link, there is no answer here. Jun 30, 2017 at 13:40
  • Sorry for the short answer - I felt strongly about correcting the only other (wrong at the time) answer but I got no Sitecore instance with WFFM handy, only experience from a past project. Jul 21, 2017 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.