Title: No input validation
Last modified: December 6, 2016

---

# No input validation

 *  [vaidotask](https://wordpress.org/support/users/vaidotask/)
 * (@vaidotask)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/no-input-validation/)
 * Using php code to display form: `<?php echo smlsubform(); ?>`
    When name and 
   email is empty success message is displayed. There should be an error state when
   input is empty or email is invalid.

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

 *  [wdolby](https://wordpress.org/support/users/mdolbear/)
 * (@mdolbear)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/no-input-validation/#post-8840470)
 * Someone posted this useful bit of code that solves the problem:
 * <script type=”text/javascript”>
    jQuery(document).ready(function() { jQuery(‘
   input[name=”submit”]’).bind(‘click’, function() { var nameLength = jQuery(‘input[
   name=”sml_name”]’).val().length; if (nameLength < 3) { alert (“Please enter at
   least 3 letters for name”); return false; } var pattern=/(^[a-zA-Z_.+-]+)@([a-
   zA-Z_-]+).([a-zA-Z]{2,4}$)/i; var email = jQuery(‘input[name=”sml_email”]’).val();
   if (pattern.test(email)) return true; else { alert (“Please enter a valid email
   address”); return false; } }); }); </script>
 * I just stuck it in a div at the end of the page where my register form is, works
   a treat!
 *  [vogcalgarybrandon](https://wordpress.org/support/users/vogcalgarybrandon/)
 * (@vogcalgarybrandon)
 * [9 years ago](https://wordpress.org/support/topic/no-input-validation/#post-9133816)
 * [@mdolbear](https://wordpress.org/support/users/mdolbear/) is there an updated
   version of this? It’s still not working for me.

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

The topic ‘No input validation’ is closed to new replies.

 * ![](https://ps.w.org/mail-subscribe-list/assets/icon-128x128.png?rev=1158481)
 * [Mail Subscribe List](https://wordpress.org/plugins/mail-subscribe-list/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mail-subscribe-list/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mail-subscribe-list/)
 * [Active Topics](https://wordpress.org/support/plugin/mail-subscribe-list/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mail-subscribe-list/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mail-subscribe-list/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [vogcalgarybrandon](https://wordpress.org/support/users/vogcalgarybrandon/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/no-input-validation/#post-9133816)
 * Status: not resolved