Support

Account

Home Forums Bug Reports Required fields not working alongside gutenberg

Solving

Required fields not working alongside gutenberg

  • Gutenberg has been out for months but required fields from ACF still does not work on pages that uses gutenberg editor?

    Does anyone know how to fix this properly? I see other similar forum threads but some of them are marked as solved without any apparent solution, whats going on here?

    I don’t feel its clear anywhere that ACF does not work properly with latest wordpress (since it’s based on gutenberg) and has not since WP 5.0 released back in late 2018. It says the ACF works on WordPress 4.7.0 or higher but this is simply not true?

    I would be very thankful for a more indepth answer on why ACF has not been patched to fix this (in my opinion) major issue? (Please use big words, i’m a dev)

    // Jesper

  • I’ve been told via support that it is being worked on. I don’t understand this at all, especially for a paid plugin – shouldn’t there be some clear discussion of the problem? an ETA on a fix?

    Are other people able to use this plugin? It seems like the one thing this plugin does ( add custom fields ) isn’t working.

  • The issue is the way that the new editor saves posts. Because of this the ACF validation cannot be run because the devs of the new editor with their infinite wisdom, have not provided a hook or mechanism of any kind that allows ACF to run any validation on the custom fields before the post is saved and/or prevent the post from being saved if anything fails. Elliot is working on this and he has been communicating the problem with the WP devs.

  • I have read through most issue threads regarding this on both acf & gutenberg github and from what I can tell WP devs have not even confirmed they are working to supply the hook ACF team has requested as solution to this problem. I hope Elliot is communicating “behind the scenes” or working on another solution because just waiting for WP Devs to change something they don’t agree is a problem will take very very long. Gutenberg has hooks that could prevent post saving but in frontend only so any validation logic would have to be moved to javascript instead of php/backend as it currently works in acf. I would imagine at least the required fields validation logic could be moved to javascript instead of backend? Please fix asap :'(

  • Validation happens on the server yes, but it is fired using JS. ACF intercepts the form submission using JS, it sends an AJAX request to validate, if validation fails ACF prevents the post from being saved. It is the last part that is a problem. There is nothing in the new editor that can prevent it from saving, there is nothing that will stop it from saving, at least this is my understanding. Beyond that you’d need to talk directly with Elliot.

  • Has this completely broken the plugin? Are there people who are still able to use the plugin despite this issue?

  • Validation when using the new editor does not work, other than this there are a few other minor issues when using the block editor. If you want to use the block editor then my suggestion for would be to find a way to not use required fields and make sure that the site works even if the information is not added. This is the way I code anyway and I try to do this because my clients sometimes have a hard time with “required fields”. So instead of requiring a value in a field I write my template code to check if the value is available and do different things depending on that. I hard code a “default value” that will be used if they do not enter a value. I put this information about what value will be used by default in the field’s instructions. Even if you set a field to be required it is, in my opinion, a bad idea to assume the field will have a value. What if the field is added after a post is created? That old post will not even have the field and it will not have a value. What if, somehow, that value gets deleted because of an error? Best practices when coding are to always validate all data.

    That being said, I still use ACF without issue, but then again I am not using the new block editor and I will likely never use the new block editor. It is not what my clients need or want. I do not build websites for people that want to, or should be allowed to, tweak the design of the site or its content. I build sites for companies where the design of every element is predetermined and fixed so that every page has a consistent look. 99.9% of my clients do not want to worry about or learn how to deal with content layout, they simply want to add content. I install classic editor on the site and then, beleive it or not, I do not use that either. I use nothing but ACF fields and I use an ACF WYSIWYG editor to replace the classic editor.

  • Any update on this issue? It’s still a problem

  • Still a problem as of October 2021. Still no solution?

  • I want to add to this that the minimum required fields in the flexible layout fields also doesn’t work.

    Currently only found the bug in the following layout, haven’t tested much further:

    Block > Repeater > Flexible layout with min. fields of 2

  • I have found a workaround here

  • Currently only found the bug in the following layout, haven’t tested much further:
    https://kuncimain.com/
    Block > Repeater > Flexible layout with min. fields of 2

    REPLY

Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘Required fields not working alongside gutenberg’ is closed to new replies.