Hi everyone -
I've just downloaded Nodereference Explorer and it looks great. Out of the box everything appears to be working fine. I get a nice dialog and am able to select a node, click "ok" and my Node Reference field is populated. But when I click save I get this error:
this post can't be referenced
Here's what gets placed in the Node Reference field when I've selected a node using the Nodereference Explorer widget (I've attached a screenshot, too):
Familiar Reptiles and Amphibians [nid:2003]
Can anyone tell me if this is the expected format and if so why am I getting this error? Thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | node_explorer.jpg | 66.74 KB | oncreative |
| Picture 3.png | 40.75 KB | jbernal.web.dev |
Comments
Comment #1
PixelClever commentedI can confirm this same issue, but only when using a cloned view. The default views seem to work without showing this error, but using a clone with no modifications doesn't work.
Edit: After messing around with it for a while the default views stopped working too. I didn't alter the default views, only switched back and forth between views.
Comment #2
PixelClever commentedComment #3
davidburnssubscribe
Comment #4
davidburnsAfter debugging back into nodereference module and discussing w/ @eaton we found that the "Default" -> "Use Pager" for whatever view you are using for nodereference_explorer needs to be set to "Display ALL values". Then you override this on the specific display to limit the number of items that appear inside the modal popup window.
Comment #5
fonant commentedThere's a nasty bug introduced into Views with version 6.x-2.11 that alters the global user's roles array. This causes all sorts of problems including the error message above where role-based permissions are being used.
Fix will be in the next release of Views, patch is available from the issue:
http://drupal.org/node/832954
Comment #6
oncreative commentedHi,
I'm not using a cloned view, I've removed all Pager options, I've applied the patch from the #5 post to the Views module but I still get the 'this post can't be referenced.' error.
I've removed and re-installed the module, I've tried different versions of jQuery and have run out of ideas. Anyone got any thoughts as to what to try next?
Thanks.
Comment #7
oncreative commentedAh, if I use the old version nodereference_explorer-6.x-1.0.tar.gz then it works. Trouble is the explorer now looks terrible and it difficult to use (see attached screen grab).
Comment #8
eaton commentedJust a heads up: we're running into this now and I'm doing some troubleshooting. By ensuring that the pager settings for the default display on the view didn't have paging turned on, we eliminated the problem in Views 2.0. But when we upgraded to Views 3.0, the problem re-appeared. I suspect a collision with Views 3's new pluggable pager mechanism, but I'm in the process of verifying.
Comment #9
gnindl commentedIt seems like the nodereference validation includes arguments AS WELL AS filters, whereas the latter is not done properly. I have a customized view with a CCK field called "Description" (field_description). The following query is passed to Views:
The WHERE clause
(UPPER(node_data_field_description.field_description_value) LIKE UPPER('%%'))is not right as it excludes all nodes which don't have a description! If I remove the description filter everything works fine again!
In short, try playing around with your filters and remove them if necessary. The argument "Node:Type" should have as default argument the content type you want the view to be limited too. Alternatively you can also specify the content type string within your CCK field settings (View arguments).
Comment #10
DarkEthos commentedAfter many hours trying patches and following a long trail of possible reasons, I returned to gnindl suggestion above. I loaded up the nodereference_explorer_default view and removed the filter Node: Updated date exposed. The error has gone away.
I hope this helps someone else.
Comment #11
Vote_Sizing_Steve commentedSubscribing.
Comment #12
jpklein commentedGnindl's suggestion in #9 worked for me as well. With Views 6.x-2.11, it looks like this isn't so much a bug as configuration error. To elaborate:
Nodereference Explorer requires two Displays for each View that you assign to a nodereference field - 'Defaults' and 'Page'. Optionally, you can set a 'Block' display to show a preview of the referenced node beside the autocomplete field on the node-edit form.
The Page display is used to populate the popup dialog that appears when you click the Browse button next to a field. You can add all the Fields and Filters you wish, as long as you make sure to override the Defaults display first. Do that by clicking the clicking the 'Override' button that appears in the top-right corner of the settings panel before making any configuration changes that ought to apply only to the explorer dialog - like when selecting the 'Table style' and Pager in Basic settings. (Note that overrides in Basic settings take place on a field-by-field basis, while overrides for Fields, Filters, and Arguments apply to all settings in the block)
The Defaults display is used in two important ways: 1) to populate the dropdown of the autocomplete field, and 2) tovalidate the contents of the nodereference field on form submit. It's because of this second point that you may be getting the 'Post can't be referenced' error. Since the drop-down Filter fields don't exist on the form after it's been submitted, Views substitutes null values when making its queries, causing them to fail like gnindl detailed above.
So instead of adding Filters to the Default view (to limit results to a certain content type, for example) you can add them as Arguments. Why? Because arguments can be assigned a default value which will be used during validation. You can do that by selecting "Action to take if argument is not present > Provide default argument" on the argument's settings panel. To clean up the autocomplete dropdown, I also like to set the default Style to 'HTML List', Row style to 'Fields', and then remove the Labels from each of the fields I want to display (via each field's settings panel).
Hope it helps!
Comment #13
gnindl commentedAs stated by jpklein the "Defaults" display is used as validation layer. According to the previous comment I think the best way to do it is to:
- Set up exposed filters in Default display as you like
- Override any single filter exposed filter in any display
- Remove the exposed filters from the Defaults display
I don't see a better way to do right now. Filters which are not exposed can safely remain in the Defaults display as they will always have a value, i. e. they will be never NULL, empty etc.
Sanitized the default view has been committed it to the repository including the previous suggestion:
http://drupal.org/cvs?commit=503200
Comment #15
reallyordinary commentedI just upgraded to the latest version (the one released on March 11) and am now running into this error. I've tried all of the above suggestions and they haven't worked.
Comment #16
core44 commentedSame issue here, latest views 3 dev 6.x. I'm using an edited clone of the default view which causes this error. The default view works fine. It seems to me to be a an issue with permissions as user 1 can reference nodes using the cloned view without issue but other roles cannot and receive the error. "field_name: this post can't be referenced."
EDIT: I had a UID argument on the default display of my cloned view restricting reference of nodes to those created by the currently logged in user. Removing this argument (but leaving it on my table view (the one used to select the nodes)) fixes the error. However, as a fallback the autocomplete field now allows referencing of all nodes which is no good. Half way there.
Comment #17
Jansel commentedHello All:
Anyone can tell me which module to use on d7 to do the same function as the explorer in d6 nodereference??