You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on inline-validation for elemental it was discovered that the current state of validation for non-inline saving is pretty bad
Validation on page save
Page save is somewhat busted. MyBlock::validate() style validation does work .. however the validation message will show at the top of the page rather than on the element as described in this bug
MyBlock::getCMSCompositeValidator() aka RequiredFields validation doesn't seem to work, nor does FormField::validate() - I tried putting a UrlField on my block which has its own validate() method though I could save invalid values.
Validation on "not inline" block.
I assume that "not inline" block means setting private static $inline_editable = false;
It's just a regular DataObject EditForm at this point. It work much better than blocks on the Page EditForm, though RequiredFields is still a bit busted because instead of a nice red error message you get a red toast that says "validation error" and no indication of what's invalid.
Same issue with a toast showing when adding a message via Model::validate() using addError(), as opposed to addFieldError() which does work OK
Acceptance criteria
Validation rules for inline and non-inline block work the same. Any validation rule that would be triggered for an inline block will also be triggered if the block is not in-line.
Errors originating from individual form fields (e.g. an invalid URL in a UrlField) are picked up by both block types.
Saving/publishing a page will trigger validation on its child block if they are in a a dirty state.
While working on inline-validation for elemental it was discovered that the current state of validation for non-inline saving is pretty bad
Validation on page save
Page save is somewhat busted.
MyBlock::validate()
style validation does work .. however the validation message will show at the top of the page rather than on the element as described in this bugMyBlock::getCMSCompositeValidator()
akaRequiredFields
validation doesn't seem to work, nor doesFormField::validate()
- I tried putting a UrlField on my block which has its own validate() method though I could save invalid values.Validation on "not inline" block.
I assume that "not inline" block means setting private static $inline_editable = false;
It's just a regular DataObject EditForm at this point. It work much better than blocks on the Page EditForm, though RequiredFields is still a bit busted because instead of a nice red error message you get a red toast that says "validation error" and no indication of what's invalid.
Same issue with a toast showing when adding a message via
Model::validate()
usingaddError()
, as opposed toaddFieldError()
which does work OKAcceptance criteria
Related
Multi PR CI
Note that the endtoend cms failures are existing
PRs
The text was updated successfully, but these errors were encountered: