I have two content types with CCK fields. One type includes a CCK field that is a node reference, the other includes a CCK field that is a user reference. Both field are Select List widgets based on Views. The view results sets are as expected when previewing them; however, I just installed the latest Views dev version (date stamped 1256344316) and when creating content the select lists are empty. I reverted to the previous dev version (date stamped 1255998945) and the select lists are populated fine.
If you need me to provide more info I would be happy to do so - I just don't know where to look.
Comment | File | Size | Author |
---|---|---|---|
#53 | Screen Shot 2013-02-01 at 3.17.47 PM.jpg | 9.27 KB | cjamesrun |
#48 | NodeReferenceInViewsNotWorking.txt | 31.95 KB | jvieille |
#47 | 614292-47-cck2.patch | 2.93 KB | rjbrown99 |
#47 | 614292-47-cck3.patch | 2.93 KB | rjbrown99 |
#26 | views-cck-bug.PNG | 10.75 KB | cesarsalazar |
Comments
Comment #1
broeker CreditAttribution: broeker commentedI am also seeing this bug on Node Reference fields using the views display option with Autocomplete textfields -- the "title" field is blank/empty. The view itself is working and the title field shows up fine in views preview. This started with the Oct. 23 release (Oct. 19 release was working fine.)
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedMoving this to CCK primarily to get Markus' attention.
The common factor here is that I committed a patch that moves field rendering around. I didn't think it would affect other things, but it appears that this may have affected CCK. The patch I committed is #502348: How group display by mutliple fields? -- can you see if this patch has caused a problem for CCK and then we can figure out what the problem is and where it should be fixed.
Comment #3
markus_petrux CreditAttribution: markus_petrux commentedUgh, it not only affects the Select widget, but also the autocomplete widget when based on a view.
It seems the 'content_php_array_autocomplete' style is broken by this change in Views. The code is tiny and can be seen here:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/cck/include...
Playing with an autocomplete path, for example,
nodereference/autocomplete/field_test_noderef/text
, the result looks like this:So it seems the value contains markup, and that breaks the nodereference widgets.
However, I'm not sure to understand the change in Views. Earl, could you please help?
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedHmm. The change I made moves the rendering of fields upstream somewhat. But I'm not sure why it would affect this.
The rows should always have had markup, so I don't understand how this changed that.
Comment #5
markus_petrux CreditAttribution: markus_petrux commentedhmm... looking a bit more at this, it seems the problem is not that we render markup here. Markup here is fine. The problem is that the following code generates only markup, with no data:
The 'rendered' elements in $result array only contain markup, without real data about the fields. So we may need to change
$this->row_plugin->render($row)
or the code that's behind that, but honestly, this part of CCK/Views integration is kind of obscure to me. I do not understand the flow. :(I guess it could also be related to the following snippet from nodereference.module:
Comment #6
fred0 CreditAttribution: fred0 commentedJust a quick observation: Using the latest CCK 6.x-2.x-dev (Oct-15) and the latest Views 6.x-2.x-dev (Oct-28) results in this problem. Reverting Views to the 6.x-2.6 release from June 10 fixes it.
Comment #7
markus_petrux CreditAttribution: markus_petrux commentedComment #8
marcushenningsen CreditAttribution: marcushenningsen commentedsubscribing
Comment #9
cyc CreditAttribution: cyc commentedsubscribing
Comment #10
DeFr CreditAttribution: DeFr commentedI've been bitten by this bug while upgrading to Views 2.7, attached patch against the latest CCK 3.x-dev seems to fix it. It's pretty much the same fix the Views Accordion module applied in #621568: Views 2.7 breaks views accordion
Comment #11
markus_petrux CreditAttribution: markus_petrux commented@DeFr: Thank you very much! :-)
After testing here, this seemd to fix Reference fields using Views here, so I've committed this to CCK2 and CCK3.
Comment #12
marcushenningsen CreditAttribution: marcushenningsen commentedJust confirming that the patch works on CCK 6.x-2.5. Thank you.
A newbie quesiton, have I understood this correct: That the patch is commited means that it's commited to CVS, and will turn up in the next stable release as well as the next development release?
Marcus
Comment #13
markus_petrux CreditAttribution: markus_petrux commentedYes, the patch has been committed to CCK2 and CCK3 branches. It should be available in the next development snapshot, and of course it will be in when a new stable package is released.
PS: I'll contact yched and KarenS to evaluate if a new release of CCK worths to save time to all of us. Otherwise, all those who upgrade to Views 2.7 but keep CCK 2.5 will be affected by this issue.
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commented(coming from #242158: nodereference dropdowns not populating with node titles when using advanced view)
Thank you, patch solves the problem. It's absolutely woth a new version. As you just stated, markus, I ran into this issue when updateing to Views 2.7, added a comment to a duplicate of this issue and I'm sure, others will follow with new duplicate issues.
Comment #15
rgristroph CreditAttribution: rgristroph commentedHi,
I may be having the same problem.
I have a content type that has a pull-down field where the allowed values are populate from a view. The content type also has fields that are a taxonomy tag (multi-select) and a pulldown text field with 3 possible values. If the view-pulldown come before (higher on the page) than the others, then the others are broken and have empty pulldowns and you can't select anything. If the view-pulldown comes after the other pulldowns, then they all work.
Since the site I am working on is complicated and has custom modules that do form_alters and etc, I set up a clean drupal install and tried to replicate the behavior. I have I so far not been able to; instead I have a separate problem; the views-populated pull down shows only the label, not the contents of the view output. (The view previews and works fine). It is a node reference that is using a view that has one filter (node published is yes) and one filed (Node: Title). In the pull down you see "Title: " for each possible selection, but nothing after the "Title:".
I also took the site I am working on and one by one disabled all the custom modules, but the problem still happens.
Eventually I will either have a version of my clean test site that produces the problem, and then I can post the whole db dump here, or I find some piece of the development site that I can disable to make it work, and I will focus on that. In the meantime if anyone has suggestions to narrow the search that would be appreciated.
As a final weird observation, this bug appears for user 1, and for at least some users with just "authenticated user" permissions everything works perfectly.
--Rob
Comment #16
Anonymous (not verified) CreditAttribution: Anonymous commentedDo you still experience this problem, after applying the patch? Have you installed Views 2.7 on both websites?
Comment #17
rgristroph CreditAttribution: rgristroph commentedOn the "clean" site I was using views 2.7. On the dev site I was using views 2.6, I upgraded to views 2.7, and the same behavior remains, except that now the view-based pull down also has no values in it. The 614292.patch above caused the views-based pull down to start working again, but any pull downs after it still do not work, unless you are not the admin user.
It continues to work better if you have a less privileged account, which I will try to use to narrow this down. I will hopefully post more on this tomorrow.
--Rob
Comment #18
Anonymous (not verified) CreditAttribution: Anonymous commentedSo I'd suggest tu open a new issue, as the Views .27 compatibility issue is fixed for you with the patch and your problem already existed before updateing to Views 2.7.
Comment #19
markus_petrux CreditAttribution: markus_petrux commentedThis is already included in CCK 6.x-2.6.
Comment #20
BerkeleyJon CreditAttribution: BerkeleyJon commentedI have just upgraded to both Views 2.7 & CCK 2.6, and *am* seeing this problem. It appears that CCK 2.6 did *not* fix the problem for me.
The dropdowns are empty for both admin and non-admin users.
Comment #22
patcon CreditAttribution: patcon commentedI think this might still be an issue for user reference field... When using autocomplete with advanced view selection, the autocomplete functionality puts the title field (I'm using a content profile relationship) as the final suggested input, instead of the username, and submitting gives this:
found no valid user with that name.
I'm using D 6.14 and views 2.8 (and CCK 2.6)
I very rarely reopen issues, so hopefully I'm not in the wrong here :)
Cheers all!
Comment #23
markus_petrux CreditAttribution: markus_petrux commented@biocomp.pat: It may or it may not be related.
Please, open a separate report with as much information as possible to reproduce the issue. Thanks
Comment #24
patcon CreditAttribution: patcon commentedIn case someone else stumbles across this, I figured my issue out, but it's way to complicated a specific to do up another issue.
My advanced view selection was fairly complex, and involved a content profile relationship in order to get some of the fields I wanted displayed during user reference autocomplete. My problem (with autocomplete adding the Node:Title from the relationship instead of the User:Name) went away as soon as I added the field (
Relation
) Node: Title, which I didn't have before.So now it was filling in the correct user when I'd made a choice, but it still took me a sec to figure out how to exclude the "User: Name" data from the end of each autocomplete line... like I could easily do with a node reference (see #375690-9: Nodereference autocomplete doesn't match all of view's fields)
I solved this by adding User: Name and then excluding it. I'd already had it in my view, and I think I had to remove the field then add it again to make it happen, which gave me some grief.
Anyhow, hopefully this helps someone else!
Comment #25
neocisco CreditAttribution: neocisco commentedSubscribing
Comment #26
cesarsalazar CreditAttribution: cesarsalazar commentedI still have this issue using CCK 2.6 and Views 2.8. It was working fine with views 2.6.
The radios have the correct nid values, but the node title is not being displayed. The view I'm using is very simple, it only contains the node title and a couple of filters.
Comment #27
ti2m CreditAttribution: ti2m commentedMeant to post here, not in #625008: Nodereference using view to select node - broken, but guess this time it was an issue with views (was using latest cck 2.6 but stable views 2.8). seems to be fixed with the latest views 2.8 dev
Comment #28
ti2m CreditAttribution: ti2m commentedwas wrong, still not fixed!
major problem is that $field->content in views-view-fields.tpl.php is empty (I use the raw for now to fix it). $field->content is supposed to be set in views\theme\theme.inc in template_preprocess_views_view_fields() through $field_output = $view->style_plugin->get_field($view->row_index, $id);
This call goes back to render_fields in views\plugin\views_plugin_style.inc row 31
Here it ends for me as I have no clue where this theming function is defined. Am not an expert on Views/CCK and have actually no clue whatsoever whats going on in there. Am not sure if this is a CCK or Views probelm. Can someone help me out on this?
Comment #29
BerkeleyJon CreditAttribution: BerkeleyJon commentedPeterP - I think you meant views\plugin\views_plugin_style.inc row *231*.
It seems that this is a theme-related problem, which would explain why most people aren't seeing it. In particular, I've been having the problem with our own custom theme, but it went away when I switched to another theme (Garland).
In particular, the problem was solved for me when I deleted the template file "views-view-field.tpl.php" from my custom theme -- even though the file in my theme was identical to the file modules/views/theme/views-view-field.tpl.php!
Perhaps the views data aren't being correctly passed to the theme's template files, but are being correctly passed to the module's template files? I'm afraid I don't know much about how this happens. Can anybody else help out?
Comment #30
DeFr CreditAttribution: DeFr commented@BerkeleyJon: Thanks for the additionnal informations, it helped a lot to reproduce the issue over here :-)
Long story short: yes, copying views-view-field.tpl.php from views directory to your theme directory will trigger http://drupal.org/node/591804 , which means that Views preprocess functions don't applies as expected and you don't get the expected result. (There's also the fact that as long as it's only in Views theme folder, views-view-field.tpl.php isn't really applied, for performance, a function is used instead...)
Hopefully this D6 bug will be fixed at some point. Before that, you basically have two options: don't overide the field template or replace in your .tpl.php the $output variable with
$field->advanced_render($row)
. (Alternatively, you should also be able to manually load Views theme.inc in a custom module hook_init). While testing though, it didn't look like this completely fixed the issue, so if at all possible simply don't override views-view-field.tpl.php(For the record, what's setting the $output variable used in views-view-field.tpl.php is
It's probably broken in CCK only because it's using a custom style plugin which does as little rendering as possible, but theorically it will break everywhere if you override every Views theme function that are defined in its theme.inc )
Comment #31
gilcpd CreditAttribution: gilcpd commentedsubscribing
Comment #32
rar CreditAttribution: rar commentedWorkaround: There is one line in views that seems to cause this problem. I'm not sure if this is a CCK or Views issue but I'm posting here to show in which file in views issue originates and how to get around this issue. Using CCK 2.6 , Views 2.10 , and Chameleon theme.
See #767792: Upgrade to views-6.x.2.9 and/or 6.x.2.10 breaks existing gmap views and Content-Types based on views and comment
http://drupal.org/node/767792#comment-2831618 for more details.
Comment #33
alisonI've been having this problem since Views 2.7. Now using Views 3 and CCK 2.6 -- I applied the 2 patches you're required to apply to use Views 3 + CCK.
Can't seem to get my nodereference fields (that use Views) to work anymore!! What are people doing to deal with this, exactly?
Thank you!
Comment #34
alison@me (#33)
So using the Autocomplete widget option seems to have worked, though I'm wary. Is this what people have been finding, or...?
Comment #35
alison@me, again...
So apparently I missed the memo that you have to have Node: NID as a field in a view you're using for a nodereference field? I think previously you were supposed to make your argument validate by NID or have the default argument by "node ID from URL" or something like that, but unfortunately I don't remember exactly. Let me put it this way: I added Node: NID as a field in the view I'm using for a nodereference field, and the Autocomplete and Select widgets are both working as they should for me now. I've also realized that (unlike what I said in #34) the Autocomplete widget wasn't "really working" until I did this. I say it wasn't "really working" because it was working for nodes (that have the nodereference field) in English/default language, but not for translated (Spanish) nodes. I'm not sure what the problem was -- the nodes being referenced are images that are language neutral, could be something there.
In case it matters, here's what happened when I was using the Autocomplete widget without adding the Node: NID field to my View (very similar to what others have described, but different variables, so hopefully helpful):
As I mentioned previously (#33), I'm running Views 3 and CCK 2.6, with the two views3+CCK patches, and I've experienced variations of this bug since Views 2.7 (though I skipped from 2.8 to 3). (Earlier the bug didn't seem to delete field contents, the nodereference field/Select widget was just blank -- not "None".) I have not copied "views-view-field(s).tpl.php" (or any Views templates) into my custom theme directory (nor have I customized any Views templates in the module directory). Please let me know if there are any other details I can provide to help work on this problem. Thank you!
Comment #36
anvar.validi CreditAttribution: anvar.validi commentedI've met the problem. (Views 6.x-2.10, CCK 6.x-2.6).
I had a complicated view with 2 relationships (both user and node reference).
Names of fields generated by views were strange: instead of title and nid fields, i got title for node, but nid for related field. I looked at views sql:
SELECT node.nid AS nid, node_node_data_field_modules.title AS node_node_data_field_modules_title, node_node_data_field_modules.nid AS node_node_data_field_modules_nid, node.title AS node_title
content_plugin_style_php_array_ac.php can't handle such things, so i got a listbox with only one value.
Comment #37
fourfour2 CreditAttribution: fourfour2 commentedI have encountered this problem with nodereference.
The view I have created was giving the correct output but when I go to add content, the drop down list shows "Title:" and then 2 of the four required results on a horizontal line.
Tried the things that have been mentioned by "alinsonjo2786" above but still no luck.
Hope there is a solution???
Comment #38
gsquirrelIn case it is useful to anyone else I also had this problem - my node reference field was working fine but since upgrading views no longer had any items to select, and I tried the suggestion above of adding node: nid as a field to the view, and it then worked as before. You can also set the nid not to display and it still works.
Comment #39
danzsmith CreditAttribution: danzsmith commentedI was having the exact same issue with a node reference and just a simple view - blank values. I upgraded to CCK 2.7 and Views 2.11 and the issue went away. I verified that autocomplete, radio and select lists all work.
Now, if someone could tell me how to expose a views filter in this scenario, my problems would really be solved!
Comment #40
vivdrupal CreditAttribution: vivdrupal commentedAlso had the same problem - node reference not populating select list.
It got solved by adding node: nid as a field to the view.
Working with CCK 6.x-2.7 and Views 6.x-3.0-alpha3.
Comment #41
vivdrupal CreditAttribution: vivdrupal commentedA follow-up to my post above:
If the 'Number of Values' of the field is set to have any no. more than 1, it does not remain a Select list drop-down, instead the complete list is expanded on the form.
Comment #42
momper CreditAttribution: momper commentedsame problem
Comment #43
clashar CreditAttribution: clashar commentedsubscribe
not sure yet if it's related to me as I have one node reference field that is ok, and another could be displayed if I only add there node:nid or other CCK fields.
Comment #44
damienroussat CreditAttribution: damienroussat commentedHi there,
Well, after a lot of reading and searching for a solution to my problem and a lot of tests, I should admit that I have no idea how to fix my problem, and that I have this problem with Drupal 6.20, CCK 2.9 & Views 2.12, so all the latest releases for D6 :
I created a NodeReference field with multiple values on a User Profile (with Content Profile) called 'Structures', a 'Structure' being a normal content type with CCK fields. From that profile, I wanted to reference items that would enable me to short list the access of the current logged in user to these items and their child nodes (a sort of custom business ACL). Then I created a 'Product' content type with a nodereference field (Selection widget) referencing a 'Structure' (for the structure manages the product, and a user has responsability for a shortlist of Product).
From there I created some other content types (lets call them X) all referencing a 'Product', all having a node reference field (selection widget) to let the user choose in a list of available Products.
My point was to use Views to restrict the products available in the select list to the ones managed by the Structures referenced in the current User Profile (complicated but necessary to explain my problem !) : with the help of the Reverse Node Reference module, I got the correct preview for my shortlist, except that in the selection widget only one result appear (I know of that problem, and read about solutions in other posts - this is not my main point here).
To get over that, I created a small module called Views Custom Prerender overriding views_pre_render(&$view) just to replace the nid row result (which was, whatever the query, the nid of the user) with the X nid (X being a content type I mentionned earlier). The outcome being that my selection list is correctly populated with the correct names and stuff, BUT :
when I try to create a X, selecting a Product in the user-customed shortlist, I have the following error message :
So my problem is not about correct display of the selection list, but about validation and content population after form submission.
Following all the discussions in that list, I also looked in the nodereference.module file, line 841 :
which still looks to be the problem to me, given that the following line (line 897) :
returns no result, which is why the error message is triggered.
Please somebody, help me, I did all my best those last days but I ran out of ideas or solutions....
Big thanks,
By the way, here is the code of my Views Custom Prerender module :
$row->node_node_data_field_structure_nid being the nid of the X content type being rendered by the view to populate the selection list. Thank you guys.
Comment #45
damienroussat CreditAttribution: damienroussat commentedOK, I mostly found my problem, but not how to solve it.
The problem comes that by creating a "Views Custom Prerender" override module, I messed up the query executed at validation time, during the X content type creation. Of course, the whole was a bad idea, but what to do when you have nothing else ?
Because overriding the $row->nid in the $view->result corrupted the 'INNER JOIN' clause in the auto-generated view query.
I fixed it the very very hard way, meaning adding that very ugly code to the cck/includes/views/handlers/content_plugin_display_simple.inc, line 37 :
with node_node_data_field_structure being the temporary field containing the correct nid of the object I was looking for.
I know everything of that is very very poor, but still, let me share it to you, still hoping for a miraculous solution to avoid it...
Comment #46
dcarr CreditAttribution: dcarr commented#40 adding the Node ID to the fields and selecting exclude form display made my multiple selectbox nodereference field show the list values in the view. Thanks!
Comment #47
rjbrown99 CreditAttribution: rjbrown99 commentedI 100% agree with #35 - my view+select list was not working and I had no clue as to why until I found this issue. I did not realize nor did I find documentation that specified that Node:NID must be in the view.
I created a documentation patch for both CCK trees that indicate that for select widgets you need to include Node:NID in the view. That's a few hours of my life I won't get back so hopefully this will help someone else if we can get it in.
On another note, I also found this helpful: #998494: Node Reference field always displaying 10 results when using the Advanced View option. [views-6.x-3.x], which is a different problem but was related to seeing the correct output in my view.
Comment #48
jvieille CreditAttribution: jvieille commentedI still have issue:
- a node reference field correctly displays values for selected nodes
- the same field as exposed filter is not populated
- I tried to add a node:nid hidden field, but it did not help
Attached an export of the views
The problematic field is called "Publication" - the field is OK, the filter is not.
Any help appreciated
Comment #49
dpatte CreditAttribution: dpatte commentedI also have a similar issue.
#1166234: Field values aren't displayed when using Views to filter node reference select list (/w Fix)
My comments are there.
For the node title, I can see its label, but not its data !
Comment #50
rougekris CreditAttribution: rougekris commentedHi guys,
I'm also getting this, using CCK 2.9 and Views 3.0. The process?
1) Set up a node reference
2) Choose a view to select from
3) Edit the node in question to pull the special list in
The view was built with absolutely nothing but a 'Node: Title' field. There's no trickery going on, it's a view that will spit out the title of every node created on the site. The node reference however, pulls back nothing.
Really not sure on how to approach a possible fix, because I don't think this piece of functionality works properly.
EDIT: Grammar
Comment #51
rougekris CreditAttribution: rougekris commentedNeed a solution on this guys. Node Reference is broken at the moment.
Comment #52
rougekris CreditAttribution: rougekris commentedBump.
Comment #53
cjamesrun CreditAttribution: cjamesrun commentedWhat version of CCK and Views are you using. My Node references that are using views are all not working correctly.
the auto complete ones fits all of the correct nodes as tiny, tiny lines into the small drop box. When I change it to a select list. The values are correct but the displayed values are blank. See below:
Views 6.x-2.16 CCK 6.x-2.9
Comment #54
cjamesrun CreditAttribution: cjamesrun commentedNarrowing it down a bit, I have found that either the data isn't being pass, or it is not being rendered correctly in content_plugin_style_php_array_ac.inc ... line 24 - 27 :
Specifically the 'rendered' field. 'title' is going through it seems, but the rendered row is coming back as an empty string.
Any thoughts as to why? This is the same scheme that is used in the jump menu for views. Labels are coming through, If I add labels to each field, the labels show up inline, but the actual field data does not.
Even if the view is executed earlier in the nodereference.module script, say line 859, 'renedered still only provides the labels for each of the fields and not the field values. Am I missing something on how to set up the view. I have three fields, and they are NID, Title, and another field.
Comment #55
cjamesrun CreditAttribution: cjamesrun commentedI switched to using a table display, and I am re-using the view in multiple node references on the same page, and the first field reference has a problem, the others on the page render properly. Even if I change the order of the fields on the edit/add page the first one will not display correctly, the Rows do not render, but the second and so forth the rows will render. Is there a method to pre-render the view, so that it will work the first time through?
Has anyone else found a work around, or solved this? I am really stuck.
This is not just for the select list view, all of the node reference fields work AFTER the first one doesn't function, The widget type does not matter.