Problem/Motivation

When an entity delete form implements ContentEntityConfirmFormBase the validation of field constraints will still happen. In case the entity fields data is not valid anymore the deletion will not happen, moreover it ends up with "... NestedArray::getValue() must be of the type array, null given ..." as the form element is not present.

You can reproduce as follows:
- For a content type add link field and create a node with correct url
- Update the url directly in the database to make it invalid
- Try to delete the node

Proposed resolution

Make the ContentEntityConfirmFormBase prevent the validation of field constraints.

Remaining tasks

-

User interface changes

-

API changes

-

CommentFileSizeAuthor
#6 no-validation-2232321-6.patch664 bytesberdir

Comments

blueminds’s picture

Issue summary: View changes
berdir’s picture

Issue tags: +Entity Field API
sun’s picture

This reminds me a lot of #588550: Allow the user edit form to only ask for the current password when necessary (in a followup confirmation step)

The very old/experimental approach over there tried to fully remove the separate concept of confirm forms, and instead, make the form that needs confirmation dynamically rebuild + adjust itself to

  1. remove #access to all form elements
  2. backup the submitted form values
  3. only show the confirmation elements
  4. upon confirmation, (optionally) re-inject the originally submitted values

That was for a more complex case of a confirmation form though (changing your password requires to confirm with your current password).

Aside from that, isn't the concrete case here going to be fixed by #216064: Entity form "Delete" button triggers server-side + HTML5 form validation; change "Delete" button to a link ?

berdir’s picture

Entity confirm forms are often displayed on separate pages, it is not something that happens as part of a form submission, so no, it's not really related to that.

amateescu’s picture

Title: Limit validation errors on confirm form. » Limit validation errors on confirm form
Component: forms system » entity system
Priority: Normal » Major

#2235457: Use link field for shortcut entity is now blocked on this, so updating the priority to match the other one.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new664 bytes

I think this is all we need here?

We'll need test coverage however. Maybe it's easier to just merge this into the shortcut issue as it needs it to work?

amateescu’s picture

Status: Needs review » Closed (duplicate)

Done :)