-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Required fields in Gutenberg blocks #90
Comments
@philbraun Thanks for the topic. Currently, there seems to be no way to get fields in Gutenberg blocks act as required. Under Beta 3, setting a post relationship field to required seems to be able to do bad things. Perhaps you have some code in your theme/plugins that are hooked into this filter and causing an infinite loop? |
@elliotcondon Still testing, but you're right, it is almost certainly related to a Theme: I'm using Genesis (2.7.1), and it's the 3 Genesis metadata boxes (SEO, Layout Settings, Scripts) that are crashing. Hide them all, and it works. However, I have a suspicion that this Theme metaboxes infinite loop only happens when using ACF Blocks, I haven't been able to get them to crash using any other Block yet. Later today I'll recreate your demo testimonial block and see what happens. |
In my tests (5.7.13 and 5.8 RC 1 under WP 5.1.1) it is not just fields within blocks whose "required" setting is ignored when using the Gutenberg editor. Regular ACF custom fields are not validated either i.e. validation doesn't work at all, anywhere. Is this a known bug? EDIT: Digging deeper I found #113, from which I gather that WP does not currently have a API for AJAX validation. Fingers crossed that the Gutenberg team pull something together in time for ACF 5.8's official release. Field validation seems like quite a major feature to drop. |
Still no API as of 7 August 2019 #113 |
Is there a workaround to make work the acf marked as required? |
This is a huge problem that seems like it should be a priority. In order to deliver a project in time I may be forced to drop the block editor altogether. :-/ |
BTW, it appears this issue with validation appears to have been open for a year? Really? |
Hi @timnolte Unfortunately, it seems the Gutenberg ticket regarding this API has gone stale. I just checked and can see a few more similar tickets have been opened, but with no solution yet. |
@elliotcondon I'm not sure, but could it be that the Gutenberg team will not be implementing validation as we know and love it, but wants us to rely on the Of course, some feedback to the user on why the post cannot be saved would be super helpful and might not be straight forward to implement in ACF.. |
Is there any news on this? Just came across this myself and wondered why the fields were not validating when used in a block. |
Hi @landwire. No news to share just yet, except that we will begin work in this area shortly now that 5.9 has been release - which includes our initial PHP validation solution for the Gutenberg editor 👍 |
Is there any news related to this issue? |
@elliotcondon It's been almost a year do you have ANY progress on fixing this? This is a MAJOR regression that's been open for almost 1000 days! |
Still no change? |
Hey everyone, There's more information on this issue here: #113 There's lots of links on that thread to various Gutenberg/WordPress issues which have prevent us being able to jump in with an elegant solution to this issue. That said, this is an issue we want to solve as soon as we can, and we hope to make progress on it soon. We'll share more information as soon as we know in which release this will fall under! Thanks, |
@lgladdy thanks for the update. I have suspected that the challenge has been a lot to do with Gutenberg. |
Hello everyone. Also, I was wondering if this workaround would be a good recomendation for this issue: https://support.advancedcustomfields.com/forums/topic/required-fields-in-gutenberg-editor/#post-155852 |
For some reason validation isn't enabled by default unless the blocks are registered with |
Hello @Log1x thanks for that! But actually I am using block.json, I even tried to add that piece of code to it but I'm facing the same situation still :( |
Currently, there seems to be no way to get fields in Gutenberg blocks act as required.
In my limited testing, under ACF 5.8 Beta 2 posts were saved regardless of any "required" setting.
Under Beta 3, setting a post relationship field to required seems to be able to do bad things – I've just had 3 posts go to an uneditable state with instant
Fatal error: Uncaught Error: Maximum function nesting level of '256' reached, aborting! in /Users/philby/Sites/mysite/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php on line 144
(not 100% sure this is related to the required setting yet, but not turning it on seems to make things much more stable).
The text was updated successfully, but these errors were encountered: