On Views 6.x-3.0-alpha3 each time I add an argument then this error displayed:
"warning: Invalid argument supplied for foreach() in /home/mysite/public_html/includes/form.inc on line 1211."

- Views can Preview data correctly but CCK nodereference (using Views+arguments) only display 1 row (don't know if this issue related to Views or CCK, but CCK shows no error when create nodereference views, so I posted here)

NB:
I'm using:
- Drupal 6.19, PHP 5.2.14
- jQuery Update 6.x-2.0-alpha1
- Content Construction Kit (CCK) 6.x-3.x-dev (2010-Aug-26)
- jQuery UI 6.x-1.3

Any idea where this error come from?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Fixed

Did you tryed the dev version already? It's fixed there already.

drupalnesia’s picture

Status: Fixed » Needs review

Using Views 6.x-3.x-dev (2010-Aug-18): Error fixed.
But ... CCK node reference using Views+arguments still shows 1 row data only.

Does this error related to CCK nodereference instead Views?

dawehner’s picture

Priority: Major » Normal
Status: Needs review » Patch (to be ported)

http://drupal.org/node/571990

I just thought you have one issue per issue, but i was wrong, sorry.

What do you expect it should do? Read the link above to report a bug. People shouldn't guess everything.

drupalnesia’s picture

Version: 6.x-3.0-alpha3 » 6.x-3.x-dev

The CCK nodereference using Views+argument should display all values.

I create 2 content-type: Inventory Product List (invprd) and Unit Measurement (masunt). And a View with argument = node type.

The Product contains a Product-Unit field, with this settings:
- field type: nodereference
- views name: generic_select_list
- arguments: masunt

So, the CCK nodereference should show all value related to the arguments that passing to Views. But CCK noderefence only show 1 value.

dawehner’s picture

Please read the link and paste a) a export and b) the generated sql.

As the document said the issue could be set to won't fix

drupalnesia’s picture

Here is the SQL generated by Views when I enter argument = "masunt":
----------------------------------
SELECT node.title AS node_title,
node_revisions.teaser AS node_revisions_teaser,
node_revisions.format AS node_revisions_format
FROM node node
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.status <> 0) AND (node.type = 'masunt')
ORDER BY node_title ASC

dawehner’s picture

Status: Patch (to be ported) » Active

Thanks!

What really confused me here is that you have a node: type argument

drupalnesia’s picture

Yes, because we must enter the arguments value in the Live Preview, otherwise the output will be:
- Query = No query was run

This is related to Views-arguments settings:
- Action to take if argument is not present: Hide view / Page not found (404)

drupalnesia’s picture

Status: Active » Needs work

UPDATE:
--------
I switch back to Views 6.x-2.11 and now CCK (6.x-3.x-dev 2010-Aug-26) nodereference using Views with Arguments works fine!

dawehner’s picture

Status: Needs work » Active

Even needs work means that there is a patch

dagmar’s picture

The title for this issue is wrong. Please change it.

drupalnesia’s picture

Title: warning: Invalid argument supplied for foreach() in /home/mysite/public_html/includes/form.inc on line 1211. » Using argument on Views 6.x-3.x-dev only return only 1 row to CCK Node-reference
liquidcms’s picture

just subscribing and reporting my versions which also show this not working. I have Views 6.x-2.11 and CCK 6.x-2.8 (latest release of both).

Will try upgrading to cck 3.x

liquidcms’s picture

upgraded to 6.x-3.x-dev (2010-Aug-25) and still does not return more than 1 row from the View.

this isn't a consistent issue though since i have other noderef fields which use different views and they work correctly.. so something specific to this view.

liquidcms’s picture

clashar’s picture

subscribe

clashar’s picture

sorry, duplicate

entrigan’s picture

Title: Using argument on Views 6.x-3.x-dev only return only 1 row to CCK Node-reference » Using argument on Views 6.x-3.x-dev only return only 1 row to CCK Node-reference (also user-reference)

Workaround: add the nid or uid (for user reference) to the view

Letharion’s picture

Status: Active » Postponed (maintainer needs more info)

Can this be reproduced with the recently released 3.0-alpha1 of CCK?

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
vlooivlerke’s picture

I have the same issue. Adding the nid does not work.

I have the latest views 3 dev

vlooivlerke’s picture

Status: Closed (cannot reproduce) » Active

opening issue again.

To reproduce create a view with user nodes as relationship.

A basic view that will show all user nodes when you view a node of a user. The view work and display multiple nodes, but in the node reference drop down there is only (1) node.

merlinofchaos’s picture

Status: Active » Closed (cannot reproduce)

If you're using a module that utilizes the node_access table, Drupal's db_rewrite_sql will add DISTINCT to the query which will cause this result. There is nothing Views can do about this distinct, other than to not let Drupal rewrite the query; if using Views 3.x there is an option to disable sql rewrite in the query options. Use that; this means that the query will no longer be subject to node_access rules and content the user does not have access to may appear, but it is the only solution.

vlooivlerke’s picture

Wow thanks for the quick response, but I tried your solution but no success.

Here is my simple view that shows only 1 row in node reference selection. Maybe I am doing something wrong. Is there any other way to get a similar view?

$view = new view;
$view->name = 'field_noderef';
$view->description = '';
$view->tag = '';
$view->base_table = 'node';
$view->human_name = '';
$view->core = 6;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['disable_sql_rewrite'] = TRUE;
$handler->display->display_options['query']['options']['distinct'] = TRUE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['hide_empty'] = 0;
$handler->display->display_options['row_options']['default_field_elements'] = 0;
/* Relationship: User: Nodes authored */
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
$handler->display->display_options['relationships']['uid']['table'] = 'users';
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
$handler->display->display_options['relationships']['uid']['required'] = 0;
/* Field: Node: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['relationship'] = 'uid';
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nid']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['nid']['alter']['external'] = 0;
$handler->display->display_options['fields']['nid']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['nid']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
$handler->display->display_options['fields']['nid']['element_label_colon'] = 1;
$handler->display->display_options['fields']['nid']['element_default_classes'] = 1;
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
$handler->display->display_options['fields']['nid']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['nid']['link_to_node'] = 0;
/* Field: Node: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['relationship'] = 'uid';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['element_label_colon'] = 1;
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['hide_alter_empty'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Argument: Node: Nid */
$handler->display->display_options['arguments']['nid']['id'] = 'nid';
$handler->display->display_options['arguments']['nid']['table'] = 'node';
$handler->display->display_options['arguments']['nid']['field'] = 'nid';
$handler->display->display_options['arguments']['nid']['default_action'] = 'default';
$handler->display->display_options['arguments']['nid']['style_plugin'] = 'default_summary';
$handler->display->display_options['arguments']['nid']['default_argument_type'] = 'node';
$handler->display->display_options['arguments']['nid']['default_argument_skip_url'] = 0;
$handler->display->display_options['arguments']['nid']['break_phrase'] = 0;
$handler->display->display_options['arguments']['nid']['not'] = 0;
/* Filter: Node: Published or admin */
$handler->display->display_options['filters']['status_extra']['id'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['table'] = 'node';
$handler->display->display_options['filters']['status_extra']['field'] = 'status_extra';
$handler->display->display_options['filters']['status_extra']['expose']['operator'] = FALSE;
merlinofchaos’s picture

$handler->display->display_options['query']['options']['disable_sql_rewrite'] = TRUE;
$handler->display->display_options['query']['options']['distinct'] = TRUE;

While you have disabled SQL rewriting, you also have enabled the flag to add DISTINCT to the query, which is the problem to begin with. Uncheck that box and it should begin working.

vlooivlerke’s picture

Hi, making

$handler->display->display_options['query']['options']['distinct'] = FALSE;

Stills shows only 1 node in node reference.
I am using domain access, can this be the problem?

sirpy’s picture

i've been able to use node reverse reference module to get the expected result