-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
How to do validation of the metabox forms on Save or Publish #8272
Comments
There is a long discussion about server-side awareness of blocks and I think this issue would be better if added to that discussion. Can we close this in favor of moving it to #2751? If not, can you explain why so I can get a better understanding? 🙂 |
@designsimply this is about metaboxes, not blocks, so it’s unrelated to #2751. |
This is browser validation problem and the fact that Gutenberg effectively eliminates the browser validation before the data is submitted. |
Related: #7020
There may be an option here for using validation API as a condition prior to save: |
I find it very surprising that with all of the work being done with the Block Editor that it's been over a year and this is still an outstanding issue. |
Another year and this issue is still open. :( |
We are on the verge of 2022. Hasn't it been fixed yet? |
The lockPostSaving action might be of use here. You could add some custom validation logic and then unlock saving only if it passes. |
I also think that this problem can be solved by using this API. You could just detect a change in any field of the form and dispatch it via Therefore, I would like to close this issue, but if there is anything I have missed, please comment. |
Really, so this is just being left by the wayside? So functionality is broken and now completely abandoned by new development. |
Saving in Gutenberg is done through AJAX, so browsers do not get the trigger to validate the forms that may be in the metaboxes, so if the metabox form has fields that are required or need some other validation, they will not be validated.
Maybe adding a standard feature in Gutenberg to run HTML validation for metaboxes when the user clicks Save or Publish buttons in Gutenberg? Without that, there will be a lot of issues with submitting valid input from metaboxes that need validation. If not, is there a way in with Gutenberg to stop saving of draft or stop publishing until the validation of forms is completed? Something that can be used in JavaScript or even with jQuery to intercept Save/Publish, to run validation first.
The text was updated successfully, but these errors were encountered: