Problem/Motivation

On the submissions page (/admin/structure/webform/manage/webform_id/results/submissions), deleting submissions fails with the error

The submitted value <em class="placeholder">280</em> in the <em class="placeholder">items</em> element is not allowed.

Steps to reproduce

  1. Create a webform with many submissions, for example 1000.
  2. Use the customize button to move the “locked” column to the very left.
  3. Sort by this column.
  4. Now, the error above appears every time I check a checkbox in front of a submission in the table, pick “Delete submission” from the select and press the “Apply to selected items” button.

The order of rows in the table has changed. I can also see this in the debugger, e.g. in \Drupal\Core\Form\FormValidator::performRequiredValidation, when I look at the keys of the $options variable before the $form_state->setError() call.

I am using MariaDB v11.0.2.

Proposed resolution

Add the sid as a second order column as a fallback.

Remaining tasks

Review patch or suggest a different resolution.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork webform-3426141

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

Gogowitsch created an issue. See original summary.

gogowitsch’s picture

Here is a stack trace from the debugger:

Drupal\Core\Form\FormErrorHandler->displayErrorMessages(Array, Object) (Line: 23)
Drupal\Core\Form\FormErrorHandler->handleFormErrors(Array, Object) (Line: 199)
Drupal\Core\Form\FormValidator->finalizeValidation(Array, Object, 'webform_submission_bulk_form') (Line: 119)
Drupal\Core\Form\FormValidator->validateForm('webform_submission_bulk_form', Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('webform_submission_bulk_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm('\Drupal\webform\Form\WebformSubmissionBulkForm', Object) (Line: 224)
Drupal\Core\Form\FormBuilder->getForm('\Drupal\webform\Form\WebformSubmissionBulkForm', Array, 1) (Line: 577)
Drupal\webform\WebformSubmissionListBuilder->buildEntityList() (Line: 462)
Drupal\webform\WebformSubmissionListBuilder->render() (Line: 23)
Drupal\Core\Entity\Controller\EntityListController->listing('webform_submission')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
gogowitsch’s picture

Title: Deleting submissions using webform_submission_bulk_form fails » Deleting submissions using webform_submission_bulk_form fails because row order is random
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new547 bytes

I added a patch.

jrockowitz’s picture

Version: 6.2.2 » 6.2.x-dev
jrockowitz’s picture

Status: Needs review » Postponed (maintainer needs more info)
StatusFileSize
new1.89 MB

I can't replicate this issue

S

gogowitsch’s picture

Issue summary: View changes
StatusFileSize
new19.18 MB

Thanks, @jrockowitz, for trying to reproduce this. It turns out that sorting is important to produce this problem. I have updated the steps above.

Here is a recording.


jrockowitz’s picture

Status: Postponed (maintainer needs more info) » Needs work
jrockowitz’s picture

Version: 6.2.x-dev » 6.3.x-dev

That video is really helpful. I am baffled to the root cause of that specific warning.

I am able to reproduce this

  • Using the default Contact form with 2000+ test submissions
  • Sorting by lock, star, or notes
  • Attempting to bulk delete the first submission

jrockowitz’s picture

Status: Needs work » Reviewed & tested by the community

@gogowitsch Thank you for catching that issue. I have seen similar issues when performing bulk operations with views, and it looks like you found the perfect solution—always append sorting by 'id' to ensure the record order is reliable.

Moving to RTBC with the assumption that all the tests will pass.

jrockowitz’s picture

Status: Reviewed & tested by the community » Needs work

A few tests broke but I still think this is the right solution.

gogowitsch’s picture

Status: Needs work » Needs review

EDIT: I wrote this comment after just reading the email notication on #8 - and what I wrote has become obsolete by your work. So please ignore this comment - I can’t find a way to delete it.

gogowitsch’s picture

Status: Needs review » Needs work

The current code in the PR throws an error in the CI:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 3065 Expression #2 of ORDER BY clause is not in SELECT list, references column 'mysql.base_table.sid' which is not in SELECT list; this is incompatible with DISTINCT: SELECT COUNT(*) AS "expression"

The CI uses MySQL v8.0.43, whereas locally I use MariaDB v11.5.2. I’ll attempt to reproduce it locally using MySQL.

  • jrockowitz committed 3598f6b8 on 6.3.x
    [#3426141] feat: Deleting submissions using webform_submission_bulk_form...
jrockowitz’s picture

Status: Needs work » Fixed

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

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

Maintainers, please credit people who helped resolve this issue.

  • jrockowitz committed 3598f6b8 on 6.x
    [#3426141] feat: Deleting submissions using webform_submission_bulk_form...

Status: Fixed » Closed (fixed)

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