Title: Hook for validating existing fields
Last modified: August 14, 2017

---

# Hook for validating existing fields

 *  Resolved [siddheshsj](https://wordpress.org/support/users/siddheshsj/)
 * (@siddheshsj)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/hook-for-validating-existing-fields/)
 * Hi again Chris,
 * Your plugin is working absolutely superb!! I have managed to integrate mailchimp
   plugin.
    Is it possible to validate fields using custom code?? Any hook that 
   i can use?? OR i have to manually select field’s id and validate?? Main reason
   for this is that plugin’s form is accepting white spaces as a input, so even 
   though fields are set to be required , it is considering the white space as input
 * Any help much appreciated! Thanks in advance
 * Siddhesh
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhook-for-validating-existing-fields%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  anonymized-13171256
 * (@anonymized-13171256)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/hook-for-validating-existing-fields/#post-9411113)
 * Thanks for catching this. I will publish an update later today which will trim
   spaces when validating the fields.
 *  Thread Starter [siddheshsj](https://wordpress.org/support/users/siddheshsj/)
 * (@siddheshsj)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/hook-for-validating-existing-fields/#post-9414757)
 * Thanks for the update.
    1 more issue i found out w.r.t. email validation It is
   accepting test@testcom , if you notice i dint add .com. So i guess if you are
   using pattern for validation than regular expression must have .(dot) domain
 *  anonymized-13171256
 * (@anonymized-13171256)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/hook-for-validating-existing-fields/#post-9415269)
 * The plugin uses this popular jQuery form validation plugin.
    [http://jqueryvalidation.org/email-method/](http://jqueryvalidation.org/email-method/)
 * That uses the regex in this WHATWG spec.
    [https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address)
 * I believe the reason that spec does not require a (dot) is for valid addresses
   like “root@localhost” but obviously that is unwanted in our use case.
 * Ask 100 programmers for an email regex and you will get 100 different answers.
   
   [https://stackoverflow.com/questions/46155/how-to-validate-email-address-in-javascript](https://stackoverflow.com/questions/46155/how-to-validate-email-address-in-javascript)
 * A missing (dot) is important but it’s just a typographical error and no different
   than someone misspelling their name or domain. The burden is on the user to enter
   it correctly.
 * The only way to verify an email address is to send a confirmation email like 
   WordPress does for new users.
 * Are you concerned about preventing typing errors or preventing fake emails?
 *  Thread Starter [siddheshsj](https://wordpress.org/support/users/siddheshsj/)
 * (@siddheshsj)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/hook-for-validating-existing-fields/#post-9415292)
 * Way i see it , both reasons(typing error & fake mail) are considered as invalid
   email id won’t be of help if i want to send mail or just keep record in db
 *  anonymized-13171256
 * (@anonymized-13171256)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/hook-for-validating-existing-fields/#post-9415485)
 * There is no bulletproof solution. I’m hesitant to start a Quest for the Perfect
   Regex which will only provide incremental benefits. Even with a confirmation 
   email, the burden is still on the user.
 * I will add an option to send a confirmation email to the feature request list.
 * The existing validation will have to suffice.

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

The topic ‘Hook for validating existing fields’ is closed to new replies.

 * ![](https://ps.w.org/strong-testimonials/assets/icon-256x256.png?rev=3134855)
 * [Strong Testimonials](https://wordpress.org/plugins/strong-testimonials/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/strong-testimonials/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/strong-testimonials/)
 * [Active Topics](https://wordpress.org/support/plugin/strong-testimonials/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/strong-testimonials/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/strong-testimonials/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: anonymized-13171256
 * Last activity: [8 years, 10 months ago](https://wordpress.org/support/topic/hook-for-validating-existing-fields/#post-9415485)
 * Status: resolved