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.

CommentFileSizeAuthor
#2 node.admin.nodes.patch737 bytestenrapid
drupal_get_form.txt.gz4.95 KBjoshk
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tenrapid’s picture

I 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.

tenrapid’s picture

Status: Active » Needs review
FileSize
737 bytes

Here's a patch.

jmiccolis’s picture

Patch 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.

tracstarr’s picture

will this fix all the pager problems? any module i have that uses the pager is broken

tenrapid’s picture

No, it won't.

But your problems are probably related to this fix. Try to remove tablesort_pager() from the theme('pager', ...) calls.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Those 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.

killes@www.drop.org’s picture

Status: Reviewed & tested by the community » Fixed

applied

Anonymous’s picture

Status: Fixed » Closed (fixed)