Title: regex validation problems
Last modified: August 31, 2016

---

# regex validation problems

 *  [Mick37](https://wordpress.org/support/users/mick37/)
 * (@mick37)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/regex-validation-problems/)
 * Hi
    I am using the validation regex field to capture a promo code on my form.
   At the moment the validation regex field is ^password^. I have also set the redirect
   settings to redirect to another page after the message sends.
 * I have two issues / questions;
 * 1. If the visitor enters an incorrect promo code, two error messages appear, 
   the regex fail message which i have set as ‘Incorrect discount code, please try
   again’ and also another automatic message ‘Please make corrections below and 
   try again.’ I am trying to hide the automatic message but I’m struggling. Can
   you help?
 * 2. If the visitor enters an incorrect promo code they get the error messages.
   If they don’t enter anything and just click the submit button, the field validates
   and redirects.
    Shouldn’t they get an error message when the field is left blank
   telling them to try again?
 * thanks for your help with this and great plugin!
 * [https://wordpress.org/plugins/si-contact-form/](https://wordpress.org/plugins/si-contact-form/)
 * my url is [http://www.dev.niftymarketing.co.uk/chimney.co.uk/book-appointment/](http://www.dev.niftymarketing.co.uk/chimney.co.uk/book-appointment/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/regex-validation-problems/#post-7101856)
 * Hi, for your question 1 there is a way which I have not tested but might work.
   Under **Labels -> Error Message Settings** find the following field **Please 
   make corrections below and try again.** Now all you have to do is type a full
   stop “add a dot”. This is not the best way but I am sure it will work. Try it
   and let me know how you go.
 * In regards to your second questions, is that field a required field? If it is
   does your regex code includes that option?
 *  Thread Starter [Mick37](https://wordpress.org/support/users/mick37/)
 * (@mick37)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/regex-validation-problems/#post-7101879)
 * hi, thanks for the response.
 * Re the first question, I added a full stop but all that does is publish a full
   stop in place of the error message. It is visible and pushes all of the content
   below it down. I was hoping to hide that message line completely so it does not
   appear or affect anything else around it.Any ideas?
 * Re the second question, it is not a required field as not everyone will have 
   a promo code so not everyone will use the field.
    I am using the field to capture
   promo codes to offer a different set of prices to my customer. If they enter 
   a code they will be re-directed to an alternative booking page with different
   prices. If they don’t enter a code they stay on the page and are presented with
   the standard prices. If they leave the field blank but click submit (apply in
   this case) I don’t want them to be redirected to the alternative page, i want
   them to get the error message saying ‘Incorrect discount code, please try again’
   which i have added as the regex fail message. I thought trying to submit a blank
   field when i have specified the content of the field as ^password^ would generate
   this error…
 *  [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/regex-validation-problems/#post-7101922)
 * Hi, what if you add the fail safe message **‘Incorrect discount code, please 
   try again’** to the following field **Please make corrections below and try again.**
   Under **Labels -> Error Message Settings**. Instead of the Regex fail message
   field:.
 * For your second question you might have to add some javascript code.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘regex validation problems’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/si-contact-form_dde2be.svg)
 * [Fast Secure Contact Form](https://wordpress.org/plugins/si-contact-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/si-contact-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/si-contact-form/)
 * [Active Topics](https://wordpress.org/support/plugin/si-contact-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/si-contact-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/si-contact-form/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/regex-validation-problems/#post-7101922)
 * Status: not resolved