Cleanup form error handling - #557
Merged
Merged
Conversation
Forms rely mostly on event handling right now but that has a limitation regarding errors in the framework at the moment. The previous work-around now lead to the problem that exceptions upon submit were not rendered as form errors but silently ignored and the form just didn't submit at all without any explanation. The new way to solve the originating problem is to always render form errors but still override `onError` in forms as there is a case in which it is called but no error event is emitted: In case element validation fails. It is now possible to only rely on `Form::ON_ERROR` to ensure the client's DOM is updated to reflect the state of the form properly.
Member
Author
|
@Jan-Schuppik You can test this easily by checking out Icinga/ipl-orm#171 and trying to create a contact group. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Forms rely mostly on event handling right now but that has a limitation regarding errors in the framework at the moment. The previous work-around now lead to the problem that exceptions upon submit were not rendered as form errors but silently ignored and the form just didn't submit at all without any explanation. The new way to solve the originating problem is to always render form errors but still override
onErrorin forms as there is a case in which it is called but no error event is emitted: In case element validation fails. It is now possible to only rely onForm::ON_ERRORto ensure the client's DOM is updated to reflect the state of the form properly.requires Icinga/ipl-web#408