The checkboxes for node content on admin/node do not work when you're not of the first page of results. I've tried to track this down, and it appears to be a bug in the forms system. Specifically, I think the internal validation mechanism is flawed: it is pulling a list of items to validate against from the first page of potential results, and finding no match with the submitted contents, returns the following, rather ominous, error:
An illegal choice has been detected. Please contact the site administrator.
On larger drupal sites, the admin/node interface is essntial for letting non-database savvy admins manage large amounts of contents. I managed to determine the following bug information, which should help pinpoint the source of the bug.
Coming out of node_admin_nodes_validate() (around line 1108 in node.module), the $edit array contains the following:
node_admin_nodes
Array
(
[operation] => approve
[submit] => Update
[nodes] => Array
(
<b>[214] => 214</b>
)
[form_id] => node_admin_nodes
)
However, on the "other end" in drupal_get_form() when we reach the form_validate call (around line 117), $form is carrying the following:
[nodes] => Array
(
[#type] => checkboxes
[#options] => Array
(
[213] =>
[235] =>
[188] =>
[61] =>
[67] =>
...
The fuil output is quite large. It's attached if anyone wants to look.
But the important thing is there will be no reference to node 214 from above.
My conclusion is that it's building some of the form elements to validate against from page 1 of node/admin's pager, when the node ID that was submitted came from page 2.
Where to go to correct this is beyond me; I leave it to those more skilled with form-api that I.
Comment | File | Size | Author |
---|---|---|---|
#2 | node.admin.nodes.patch | 737 bytes | tenrapid |
drupal_get_form.txt.gz | 4.95 KB | joshk |
Comments
Comment #1
tenrapid CreditAttribution: tenrapid commentedI think the problem is that we redirect in node_admin_nodes() to
$form['#action'] = url('admin/node');
on form submission. Thus the pager is not respected and the form elements are always generated for page 1.Comment #2
tenrapid CreditAttribution: tenrapid commentedHere's a patch.
Comment #3
jmiccolis CreditAttribution: jmiccolis commentedPatch worked for me. It there a reason this isn't critical? For any site with large amounts of content this is really make or break functionality.
Comment #4
tracstarr CreditAttribution: tracstarr commentedwill this fix all the pager problems? any module i have that uses the pager is broken
Comment #5
tenrapid CreditAttribution: tenrapid commentedNo, it won't.
But your problems are probably related to this fix. Try to remove tablesort_pager() from the theme('pager', ...) calls.
Comment #6
chx CreditAttribution: chx commentedThose two lines are a remnant of early form API conversion, and I am glad that people finally dare to fight such complex forms as the admin/node one.
Comment #7
killes@www.drop.org CreditAttribution: killes@www.drop.org commentedapplied
Comment #8
(not verified) CreditAttribution: commented