WordPress.org

Support

Support » Plugins and Hacks » Fast Secure Contact Form » [Resolved] Help to force MM/YYYY with regex

[Resolved] Help to force MM/YYYY with regex

  • 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:

    /^([0-1][0-9][/][2][0][1-2][0-9])$/

    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!

    http://wordpress.org/plugins/si-contact-form/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Help to force MM/YYYY with regex’ is closed to new replies.
Skip to toolbar