Title: Javascript validation not working
Last modified: August 30, 2016

---

# Javascript validation not working

 *  Resolved [ericbrissette](https://wordpress.org/support/users/ericbrissette/)
 * (@ericbrissette)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/)
 * ACF Javascript validation isn’t catching any un-filled required fields. It’s 
   not until I get to the PHP validation that I’m stopped from publishing a Page/
   Post.
 * If I disable your plugin, the javascript validation works fine, and unfilled 
   fields are flagged with their usual red labels.
 * When I publish the page, an error quickly flashes in the console, but it happens
   too fast to see what it is. I believe it’s an error 500. I’ll look through the
   logs and see what I can find.
 * WordPress 4.2.2 (Multisite)
    ACF Pro 5.2.6 ACF: Validated Field 1.7.4
 * [https://wordpress.org/plugins/validated-field-for-acf/](https://wordpress.org/plugins/validated-field-for-acf/)

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

 *  Thread Starter [ericbrissette](https://wordpress.org/support/users/ericbrissette/)
 * (@ericbrissette)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201890)
 * It may be worth mentioning that this sounds like the same issue John reported
   a few weeks ago:
    [https://wordpress.org/support/topic/use-default-acf-validation-warnings?replies=3](https://wordpress.org/support/topic/use-default-acf-validation-warnings?replies=3)
 * The “grey screen” he’s referring to is probably the PHP validation that gives
   a list of the fields that weren’t filled out properly, which only happens because
   the javascript validation wasn’t triggered.
 * While it is effective in stopping the submission, going back from that page leads
   you to the post-edit page with none of the information filled in.
 *  Plugin Author [doublesharp](https://wordpress.org/support/users/doublesharp/)
 * (@doublesharp)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201915)
 * Thanks for the report. Can you give me details on the validation config you are
   using for the field? Field type, required, read only, valuation function, unique,
   etc?
 * For ACF5 all the validation from my plugin should be server side so I’m not sure
   how it would break the javascript. Perhaps a PHP notice in the ajax response?
   Or a 500 as you mentioned? If you use Chrome developer tools to look at the response
   for the validation ajax response, which happens before the submit, do you see
   anything telling?
 *  Thread Starter [ericbrissette](https://wordpress.org/support/users/ericbrissette/)
 * (@ericbrissette)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201920)
 * The problem occurs without using the Validated Field field type.
 * In my test, I created a single custom field, (Field Type: Text), nothing special,
   just made it required, and assigned it to Posts.
 * When I attempted to publish the post, I get this in the console:
    POST [http://newsite.umpi.edu/wp-admin/post.php](http://newsite.umpi.edu/wp-admin/post.php)
   500 (Internal Server Error)
 * As for the ajax request, you’ll have to give me an idea of what to look for and
   where.
 *  Plugin Author [doublesharp](https://wordpress.org/support/users/doublesharp/)
 * (@doublesharp)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201921)
 * Thanks, I just checked out the ACF 5.2.6 changelog and it includes:
 * * Core: Improved validation logic to display HTML5 validation messages
    * Core:
   Fixed various JS performance issues
 * Both of those seem like they could cause the issue you are describing, I will
   do some testing and hopefully have a solution soon.
 *  Plugin Author [doublesharp](https://wordpress.org/support/users/doublesharp/)
 * (@doublesharp)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201927)
 * It looks like there were a few changes in the latest version of ACF that broke
   the plugin. I’m pretty busy right now but was able to identify the two problems–
   the first was how the plugin was overriding existing validation, and the second
   is some changes that were made for previous versions to properly handle field
   groups.
 * For the former I am not removing existing validation actions and this seems to
   be working. For the latter I just commented out the mods to the field group script,
   though I’m not entirely sure what the outcome of this will be. If you have any
   time to test and see if the following file works for you I would really appreciate
   it.
 * Latest version of the ACF5 validated field file can be found here: [http://plugins.svn.wordpress.org/validated-field-for-acf/trunk/validated_field_v5.php](http://plugins.svn.wordpress.org/validated-field-for-acf/trunk/validated_field_v5.php)
 * Thanks!
 *  Thread Starter [ericbrissette](https://wordpress.org/support/users/ericbrissette/)
 * (@ericbrissette)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201954)
 * I grabbed the code, and so far it looks good.
 * I have a couple basic repeater fields, which is what I assume is an example of
   a “field group”. I made certain fields within the group required, and made some
   groups required. So far no issues with validation there either.
 * So for now, I’m going to leave the new code in place on this site, which is still
   in development, and report issues I come across. If you have any specific test
   cases in mind, let me know and I’ll focus on those areas.
 *  Plugin Author [doublesharp](https://wordpress.org/support/users/doublesharp/)
 * (@doublesharp)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201960)
 * Excellent. I’ve been distracted by lots of other projects and didn’t do a great
   job of commenting why I had some of that in place, but since it was previously
   necessary I want to update the code to check the version before deciding how 
   to handle the different scenarios. Not sure when I’ll have time, but there shouldn’t
   be anything functionally different from the code you have.
 * Thanks for helping to test!
 *  Plugin Author [doublesharp](https://wordpress.org/support/users/doublesharp/)
 * (@doublesharp)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201975)
 * Hi [@ericbrissette](https://wordpress.org/support/users/ericbrissette/), rain
   delay so I updated the plugin to version 1.7.5 to include the changes for ACF
   version 5.2.6+.
 * Thanks!
 *  Thread Starter [ericbrissette](https://wordpress.org/support/users/ericbrissette/)
 * (@ericbrissette)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201976)
 * Of course. Thank you for the quick fix!

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

The topic ‘Javascript validation not working’ is closed to new replies.

 * ![](https://ps.w.org/validated-field-for-acf/assets/icon-256x256.png?rev=1116693)
 * [Advanced Custom Fields: Validated Field](https://wordpress.org/plugins/validated-field-for-acf/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/validated-field-for-acf/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/validated-field-for-acf/)
 * [Active Topics](https://wordpress.org/support/plugin/validated-field-for-acf/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/validated-field-for-acf/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/validated-field-for-acf/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [ericbrissette](https://wordpress.org/support/users/ericbrissette/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/javascript-validation-not-working/#post-6201976)
 * Status: resolved