Skip to content
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

Support validation within in-line edit context #699

Closed
8 tasks
ScopeyNZ opened this issue Jul 23, 2019 · 5 comments
Closed
8 tasks

Support validation within in-line edit context #699

ScopeyNZ opened this issue Jul 23, 2019 · 5 comments

Comments

@ScopeyNZ
Copy link
Contributor

ScopeyNZ commented Jul 23, 2019

Description

Currently the in-line editing editor and forms provide no detail on errors that have been added with validate() or via a form validator returned from getCMSCompositeValidator().

Investigation

See #688. Specifically #688 (comment) .

There's also an investigation branch:

https://github.com/creative-commoners/silverstripe-elemental/tree/pulls/4.1/validation-refactor

A/Cs:

  • Errors added using addError($message) appear on a block level within the in-line edit form after saving an individual block
  • Errors added using addError($message) appear on a block level within the in-line edit form after saving the page as a whole
  • Errors added using addFieldError($field, $message) appear on a form field (holder) level within the in-line edit form after saving an individual block
  • Errors added using addFieldError($field, $message) appear on a form field (holder) level within the in-line edit form after saving the page as a whole
  • When saving pages, all blocks are processed and those that are valid are correctly saved.
  • When saving individual blocks, the block being saved is processed and if validation messages are displayed as appropriate
  • Blocks that aren't saved keep their unsaved changes
  • The unsaved changes indicator remains on invalid & unsaved blocks
@GuySartorelli
Copy link
Member

Also relevant: #329

@GuySartorelli GuySartorelli changed the title Support DataObject::validate within in-line edit context Support validation within in-line edit context May 11, 2023
@GuySartorelli
Copy link
Member

GuySartorelli commented May 11, 2023

When saving pages, all blocks are processed and those that are valid are correctly saved.

I don't think this is an appropriate behaviour. When saving a page, if one field is valid and another is invalid, the valid field doesn't get saved to the record. Similarly, when saving a page, an elemental block should be treated as a series of fields belonging to that page.
Otherwise you might get a scenario where one block references content from another block, and only one of those blocks is valid - we probably don't want the page to show partially-correct content.

@maxime-rainville
Copy link
Contributor

Duplicate of #329

@maxime-rainville maxime-rainville marked this as a duplicate of #329 Mar 21, 2024
@maxime-rainville maxime-rainville closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2024
@GuySartorelli
Copy link
Member

@maxime-rainville Wasn't this the card we're using to track fixing up the UI?
#329 is just about getting the functionality working, but the UI will not be in a 100% ideal state after that card has been finished.

@maxime-rainville
Copy link
Contributor

I would rather use this card to track the UI changes related to Elemental validation

#1145

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants