Each time a views form is submitted (for example, after selecting items on the VBO form), a new page is loaded, and the view is re-executed in the background.
If $form_state['cache'] is not set, the form is rebuilt before validation / submission. Since the view has been re-executed, the results might have changed, which means a rebuilt form would have different form elements, leading to invalid data in $form_state['input'] that gets dropped from $form_state['values'] (or assigned to a different row).
If $form_state['cache'] is set, the form is retrieved from cache for validation and submission, which means that even if the views results changed, $form_state['values'] contains the expected data.
See #1460154: Incorrect form values selected for operations for background.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1473276-cache-views-form.patch | 718 bytes | bojanz |
Comments
Comment #1
bojanz commentedFix is simple.
Will commit this to VBO as well, so that people with older Views versions don't have problems;
Comment #2
tim.plunkettTriggering the testbot.
Comment #3
tim.plunkettThis sounds reasonable.
Comment #4
tim.plunkettEr, whoops.
Comment #5
dawehnerI totally see the problem here, so adding $form_state['cache'] solves that problem,
but i'm just wondering whether this might cause problems for websites which uses views forms not as a backend tool but on the frontpage or something similar. They will see that each request creates a new entry in the form_cache table, which isn't that nice.
So can you think of such contrib/custom modules?
Comment #6
bojanz commentedSomeone could have a VBO block on the front page.
However, this is such a deep architectural problem that even with that side effect (a row in the table per view) the solution is still tolerable.
I see no other way other than magically solving the problem of "view gets reloaded on next load" (which would require caching it in some way as well).
Comment #7
dawehnerRight. Additional if people see that's a problem they can still use some alter hook and change the value again.
Committed to 7.x-3.x
Comment #8
macman commentedHi
I think I am having the same problem on my site. However, I am running vbo 6.x-1.10 so the above fix does not apply. Can you please give me instructions about what to change? Thanks.
Comment #9
bojanz commentedVBO 6.x doesn't use Views Form.
Update to the latest 6.x-1.x-dev, retest, if the problem still exists open an issue in the queue.
Comment #10
macman commentedsorry running views 6.x-2.10
Comment #11
chris matthews commentedThe Drupal 6 branch is no longer supported, please check with the D6LTS project if you need further support. For more information as to why this issue was closed, please see issue #3030347: Plan to clean process issue queue