I'm using Views 6.x-2.12 and CCK 6.x-3.0-alpha3 and am trying to use a View to filter the nodes that can be referenced in a select list on the node create/edit form. The filter seems to work correctly, but only the labels show up in the select list, not the actual field value. I've tried this using different fields, and it is the same for any of them. For example, if the View is set to display the node title, this is what I'll see in the page source for the form:

<option value="373"> Title:  </option>
<option value="367"> Title: </option>
<option value="372"> Title: </option>

Those are the correct node ids, so the filter works, but it won't show the node titles. I'm not sure how to troubleshoot this further, so any help would be greatly appreciated.

Comments

Title:($250 Bounty) Field values aren't displayed when using Views to filter node reference select listField values aren't displayed when using Views to filter node reference select list

I have the same issue. I am using views 6-2.16 and cck 6-2.9.

In my case I have a custom content type with two node reference fields. They are both single select lists with a dropdown populated by a view with no arguments. The first node reference is required. The second node reference is optional.

The first node reference dropdown works fine, but the second dropdown shows the correct number of items in the select list, but the data shown for each node in the list is blank. Just like your case there is no field data within the option. Since I am not using a field titlelabel, all my options in the dropdown are blank.

<option selected="selected" value="">- None -</option>
<option value="2762"> </option>
<option value="2764"> </option>
<option value="2765"> </option>

Choosing an option (though blank) works correctly - but a user cannot decide which option to select.

The extra odd thing about this is that the dropdown does show field data for one single user who sees his 10 items. He has no special permissions, but his items are the first nodes that the view would find before filtering.

But I do not believe this to be an issue in views, since when i preview the view directly, it always generates the correct data for any user.

Does any of my situation match yours? Do you also have multiple node references in a single content type, or a mix of required and optional node references?

I should point out that the views used to fill both these node references use global php filters based on $user. But that doesn't explain why the first node reference works, and the second doesn't.

I modified my view to display a label of '-' and now my dropdown list shows
- None -
-:
-:
-:

So odd that it would keep the label, but drop the data. When i preview the view I see
-: Product I
-: Product K
-: Product L
as I expect.

Leaving in the title of '-' I decided to try the fields option to hide fields that contain no data. When previewing the view, there is no change from my previous post, but now in the dropdown it also blanks out the -: label for each item in the dropdown again! Something really thinks there is no title for these items.

Here is more detail about my views.
the field I am displaying is node title
but i also have two extra fields that are hidden fields: user:uid and node:type. These are required for my global php filter. Maybe that is part of the issue?

Title:Field values aren't displayed when using Views to filter node reference select list($250 Bounty) Field values aren't displayed when using Views to filter node reference select list
Project:Views PHP» Content Construction Kit (CCK)
Version:6.x-1.x-dev» 6.x-3.0-alpha3
Component:Code» nodereference.module
Priority:Major» Normal

Bounty payable by PayPal. What I'm looking for is not a work-around for my particular issue, but a recognition in either views or node/user references of the problem that prevents this from working as advertised, and a patch to the appropriate module. Thanks.

Title:Field values aren't displayed when using Views to filter node reference select list($250 Bounty) Field values aren't displayed when using Views to filter node reference select list

I now suspect this bug may only occur if there are more than one reference fields in a single content type. For the second reference field it breaks because either it performs a different sql lookup than requested, or it ignores/corrupts/uses-the-wrong $data structure in the handler.

Title:Field values aren't displayed when using Views to filter node reference select list($250 Bounty) Field values aren't displayed when using Views to filter node reference select list

What I have found is that it adds labels to all the items, but only shows the data for the first 10 items, despite my asking for all items. When there are 11 nodes, 11 labels, but only the first 10 display their data. This seems related to #998494: Node Reference field always displaying 10 results when using the Advanced View option. [views-6.x-3.x], also a node reference issue, but I have tried the latest committed dev of cck 2 and it doesnt resolve my problem.

i've dug a little deeper into cck and views.

in cck/modules/nodereference.module
in _nodereference_potential_references_views

after calling $view->execute_display
though all the array members in $result have the title in [title],
only those nodes that are in the first 10 nodes of that nodetype that i created have a value in [rendered]

there seems to be an error in execute_display, or in the setup for it, like its using some default display that is limited to 10 items.

I am using a recent official dev version that includes a recent patch that changes the $limit code. Whatever motivated that change is probably also the cause of the symptoms i am still seeing.

And deeper:

$view->execute() calls
$content_plugin_display_simple->render() which calls
$content_plugin_style_php_array_ac->render() which calls
$views_plugin_row_fields->render() which calls
$views_plugin_row->render() which calls
theme($this->theme_functions(), $this->view, $this->options, $row, $this->field_alias);

$row looks fine, so, in some cases theme() does not return the title from the row.

Title:Field values aren't displayed when using Views to filter node reference select list (/w Fix)Field values aren't displayed when using Views PHP to filter node reference select list
Component:Filter Handler» Code

I seem to have resolved the issue as follows:

It seems that the select dropdown assumes that the keys for the generated rows are sequential from 0, and it doesn't render() titles if the key is more than the number of items to be displayed in the select list, nor should it normally have to.

But PHP Filter removes rows after they are generated, meaning that the result set keys may have gaps.

If PHP filter is used, the dropdown will only render rows that have keys less than the number of items in the display list.

A FIX in this module would regenerate the results list ensuring that the row keys are sequential from 0 again.

Work Around: Add a new sort using Views PHP to sort the result set which will regenerate the results keys.

I used
return return $row1->nid - $row2->nid; (ascending)

This bug can have consequences for node reference dropdowns in particular.

Title:($250 Bounty) Field values aren't displayed when using Views to filter node reference select listField values aren't displayed when using Views to filter node reference select list
Project:Content Construction Kit (CCK)» Views PHP
Version:6.x-3.0-alpha3» 6.x-1.x-dev
Component:nodereference.module» Code
Priority:Normal» Major

Title:($250 Bounty) Field values aren't displayed when using Views to filter node reference select listField values aren't displayed when using Views to filter node reference select list
Project:Content Construction Kit (CCK)» Views PHP
Version:6.x-3.0-alpha3» 6.x-1.x-dev
Component:nodereference.module» Filter Handler
Priority:Normal» Major

Title:Field values aren't displayed when using Views to filter node reference select listField values aren't displayed when using Views to filter node reference select list (/w Fix)

Title:Field values aren't displayed when using Views PHP to filter node reference select listField values aren't displayed when using Views to filter node reference select list (/w Fix)
Component:Code» Filter Handler

I have attempted your fix with using Views PHP, but still no dice. Is this exclusive to the Alpha version?

I don't know if its exclusive to that version, and I no longer have that particular view setup in my current implementation. I do remember that I resolved it at that time by adding a standard sort filter to the view and by not using the table click sort facility.

I have this exact issue, but I'm not using Views PHP at all
just views 6-2.7

Issue summary:View changes
Status:Active» Needs review
StatusFileSize
new1.33 KB

I added a patch with a fix for this issue. Please check, if it works.