Problem/Motivation

When we restore Node , we are getting error stating: This value can not be null.

Steps to reproduce

After Debugging came to know :

1. Delete the node which has field in disabled mode (from manage display) and has required true.
2. Once deleted, click restore option.
3. You will see Error: "This value can not be null'.

Proposed resolution

1. Ideally if we are not checking validation before deleting the content then why on restore operation, because if node
is soft deleted , how can User fix the content based on valdation.
2. Validation error has no information regarding which field causing this issue.

Checked the code of EntityRestoreForm in which we are calling validation on entity before restore, which is causing this issue.

Possible Solution:

1. We can check validation before deleting with proper error message.
2. We can remove validation check on restore operation.

Issue fork trash-3571951

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anurag_nagar created an issue. See original summary.

shank115’s picture

StatusFileSize
new1.05 KB

Added #limit_validation_errors = [] to the submit button in EntityRestoreForm. This prevents the Form API from performing a full entity validation on fields that aren't present in the confirmation form.

amateescu’s picture

Version: 3.0.24 » 3.1.x-dev

@shank115, that approach won't work because no fields are present on the restore form, which means it completely bypasses the work that was done in #3566494: Better handling of unique fields.

amateescu’s picture

Status: Active » Needs review

Opened a MR with a solution that filters violations to only those coming from unique constraints.

amateescu’s picture

Title: The Value Should not be null error » Restore validation should only care about unique field constraints

  • amateescu committed 328e1e82 on 3.1.x
    fix: #3571951 Restore validation should only care about unique field...

  • amateescu committed b5891f45 on 3.x
    fix: #3571951 Restore validation should only care about unique field...
amateescu’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.