Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
here is a typical scenario:
(1) create article node/1
(2) add required field A to node type Article.
(3) go to node/1 and click delete
(4) system will require you to fill in field A before asking you to confirm the deletion.
Since we are deleting the node anyway, it shouldn't be important to validate the fields, no?
Cheers,
Albert.
Comments
Comment #1
agentrickardAbsolutely. Let's get a patch going.
Comment #2
agentrickardGreat. Now that we have client-side form validation, this becomes much harder to test.
Comment #3
agentrickardPatch with a failing test. Note that I had to add a new test for the delete confirm behavior.
Comment #4
agentrickardAnd a patch that should pass.
Comment #5
xjmComment #6
agentrickardFirst patch failed as expected.
Comment #7
agentrickardFixed a comment in the pass version of the test.
Comment #8
alberto56 CreditAttribution: alberto56 commented@agentrickard your patch in comment #7 is said to contain 0 bytes. Should we review the one in comment #4 or wait for a new version?
Cheers,
Albert.
Comment #9
agentrickardOops. Review the version in #4, which contains a comment "this should fail." that needs to be edited.
Comment #10
Robin Millette CreditAttribution: Robin Millette commentedOnce it's approved for D8, will this get backported or is it considered an API change?
Comment #11
joachim CreditAttribution: joachim commentedI say it should be backported. It makes deleting anything with required fields a total pain for users.
Comment #12
agentrickardNot an API change. THe patch just needs a minor re-roll.
Comment #13
agentrickardFinally got around to a re-roll.
Comment #15
agentrickardAnd a re-re-roll. Should be ready to go.
Comment #16
dcam CreditAttribution: dcam commentedI tested #15 and it fixes the issue for me.
Comment #17
agentrickardComment #18
agentrickardWith the new Entity system, do we actually need to back this logic up a level to EntityFormController.php?
Comment #19
dcam CreditAttribution: dcam commentedYeah, this does need to be applied to EntityFormController. Perform the same test described in the OP, except with a taxonomy vocabulary and term. If you try to delete a term with a required, empty field this form also forces you to fill out the field before deleting.
Comment #20
agentrickardMakes sense.
Comment #21
star-szrCan this be merged into #216064: Entity form "Delete" button triggers server-side + HTML5 form validation; change "Delete" button to a link?
Comment #22
agentrickardYes.
Comment #23
star-szrAwesome, thanks. I just linked here from the other issue.