Fast Secure Contact Form
[resolved] Help to force MM/YYYY with regex (3 posts)

  1. nermal.newmail
    Posted 2 years ago #

    Hi all,

    I am implementing Fast Secure Contact Form to collect registration forms for a conference. I have included a membership expiration date field, and want registrants to be able to input ONLY MM/YYYY (that exact format, with slash, and that number of digits. This way, when exported to our database the formatting is consistent).

    I wrote the following regex to accomplish this, with the intention of adding it to the 'validation regex' field:


    When I test this regex in an external validator, it works fine, accepting and only accepting the desired date format. But it does not work in the form, and returns the fail message upon form submission. I am implementing several other expressions elsewhere in the form (limiting fields to digits only, etc) which are working properly.

    Any ideas on what I am doing wrong? If we can't force the desired format it's not the end of the world, but it will save my colleague a lot of time in reformatting our database later. I'm a newbie so perhaps the solution is glaringly obvious. I would appreciate any assistance. Many thanks!


  2. Mike Challis
    Plugin Author

    Posted 2 years ago #

    Escape the slash to avoid clash with the beginning and end slashes

  3. nermal.newmail
    Posted 2 years ago #

    Thanks, worked perfectly! Figured it was something small...

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Fast Secure Contact Form
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic