-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
REST API InteractionRelated to REST APIRelated to REST API[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] EnhancementA suggestion for improvement.A suggestion for improvement.[Type] QuestionQuestions about the design or development of the editor.Questions about the design or development of the editor.
Description
Issue Overview
Sometimes it is crucial to validate input values on the server side, e.g. check if an email address is valid within the company by checking against an LDAP-Directory. (Server side because "Never trust the client" rules).
I could not figure out (overlooked?) a way to do that with Gutenberg.
Steps to Reproduce
- Hook into rest api (pre_insert_post?) and return an error, something like
return new WP_Error( 'rest_invalid_param', 'E-Mail not found in directory', array( 'status' => 400) ); - 'Updating failed' is shown, but not the specific error message.
Possible Solution
- Document how to return an error (better a list of errors) correctly.
- Display the error messages.
In a second step it would be helpful to trigger a JS event in the corresponding block, so that a visual feedback can be given in the right place.
PS.
Is there some kind of validation framework present/planned in Gutenberg that i did not see?
Metadata
Metadata
Assignees
Labels
REST API InteractionRelated to REST APIRelated to REST API[Feature] Block APIAPI that allows to express the block paradigm.API that allows to express the block paradigm.[Feature] ExtensibilityThe ability to extend blocks or the editing experienceThe ability to extend blocks or the editing experience[Type] EnhancementA suggestion for improvement.A suggestion for improvement.[Type] QuestionQuestions about the design or development of the editor.Questions about the design or development of the editor.