To replicate this bug, install drupal 6.10 with Views 6.x-2.3 and CCK 2.1, and in the CCK module group enable Node Reference, Options Widgets and Text.

Add a view (it doesn't matter what) and give it some filters (like "Node: Type" or "Taxonomy: Term"). Then expose one of the filters. Save the view.

Add a new content type. Add a a text (select list) widget to that content type - call it "Gender". In the "Allowed values list" give it the following values:

male|Male
female|Female

and save it.

Add a node reference (select list) and link it to the view under "Advanced - Nodes that can be referenced (View)" in the node reference settings.

Arrange the widgets so that the text widget appears below the node reference in the field arrangement. Save the content type.

Go to "Create content -> Your_new_content_type"

You'll notice that the node reference correctly displays all values from your view. You'll also see that "Gender" (the text select list widget) does not have any values in it (it *should* have values in it!).

If you edit your content type and re-arrange the widgets so that Gender is above the node reference, and then add go to "Create content -> Your_new_content_type" you'll see that the Gender select list now correctly displays its values ("Male" and "Female").

If you move Gender into a fieldgroup, then when adding the node, Gender will always be blank, no matter where in relation to the node reference it is (it shouldn't be blank!).

I'm using drupal 6.10, views 6.x-2.3 and CCK 6.x-2.1

The obvious fix is to not use views with exposed filters when referencing them from node_reference, so maybe this can be added to the "help" text which appears in the "Advanced - Nodes that can be referenced (View)" section? Something like:

"There are known issues with using views which have exposed filters. Rather create a copy of the view, hide the filters and choose that."

I've made this suggestion by changing line 107 in nodereference.module to:

'#description' => t('Choose the "Views module" view that selects the nodes that can be referenced.<br />Note:<ul><li>Only views that have fields will work for this purpose.</li><li>This will discard the "Content types" settings above. Use the view\'s "filters" section instead.</li><li>Use the view\'s "fields" section to display additional informations about candidate nodes on node creation/edition form.</li><li>Use the view\'s "sort criteria" section to determine the order in which candidate nodes will be displayed.</li><li>There are known issues with using views which have exposed filters. Rather create a copy of the view, hide the filters and choose that.</li></ul>'),

Comments

rgristroph’s picture

I would like to confirm that I am seeing this on CCK 6x-2.5 and Views 6x-2.7. I am seeing it even if the filter is not exposed.

I tried to make a test case on a "clean" install, with just those modules, and it did not occur. The site where I am seeing this is complicated with custom modules and etc, I am working on trying to narrow down what might be causing it.

markus_petrux’s picture

Status: Active » Fixed

@rgristroph: I think your issue is caused by different problem. Please, see the other issue you've opened: #624422: Node Reference populated by a view does not show values in selection pulldown

In regards to the original report... it seems to me things have changed significantly since then, so I'm assuming that problem was already fixed.

Please, try with latest development versions of CCK and Views, and re-check. Feel free to re-open if the problem persists.

rgristroph’s picture

I can confirm that I am seeing this issue in spite of fixing the other issue I have opened. I did confuse the other issue and this one, but this one is separate.

I am not seeing it on a minimal clean, fresh install of drupal that I did in an attempt to re-create it. I am seeing it on a larger, more complicated site that I am working on, which has the patch from 614292 and the latest views and cck, but also has custom modules that may be mucking with $form. I have tried disabling modules until it went away to isolate it, but was not successful. I am now trying to add things from my complicated site to the "clean" one until the bug re-appears. At some point I should have it replicated to where I can attach something to this report that you can use to re-generate it.

Status: Fixed » Closed (fixed)
Issue tags: -Views exposed filter

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