This is new for beta2: the View selected for the Nodereference Explorer widget must have a "Node: Nid" field, and it can't have "Exclude from display" checked. Otherwise the nid doesn't get passed to the Node Reference field and you get values like this:

Node Title [nid:]

which will get a "no valid post found" error when you try to submit.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vood002’s picture

Thanks for posting this, I didnt see this covered in any documentation and without it no worky.

beauz’s picture

Yep I can confirm this problem, hopefully see a fix soon.

gnindl’s picture

Version: 6.x-1.1-beta2 » 6.x-1.x-dev
Assigned: Unassigned » gnindl
Status: Active » Fixed

Node id can now be excluded from the display but it has to be provided as a view field. When the Node id is not included in the display the node id will be retrieved from the view result.

gnindl’s picture

Status: Fixed » Needs review

Check out the current development snapshot for testing.

gnindl’s picture

Version: 6.x-1.x-dev » 6.x-1.1-beta3
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

Les Lim’s picture

Version: 6.x-1.1-beta3 » 6.x-1.1-beta5
Status: Closed (fixed) » Active

The statement in #3 is correct for Table and Grid views. In List view, however, excluding the NID from display still prevents the autocomplete field from receiving the NID.

rjbrown99’s picture

I also have a small issue with this.

Scenario #1:
1) A 'default' view with basic settings that mirror the nodereference_explorer_default view, with the Style: Table (Selectable). The Node: NID field is excluded from the display.
2) A 'Grid' view with basic settings that mirror the nodereference_explorer_default view, with the Style: Grid, and Row Style: Fields (Selectable). The Node: NID field is excluded from the display.

This works as you might think, and allows you to properly select your fields/items. It returns the correct [nid:123] into the autocomplete box.

Scenario #2:
1) A 'default' view with basic settings of Style: Grid, and Row Style: Fields (Selectable). The Node: NID is excluded from the display.
2) A 'Grid' view with basic settings of Style: Grid, and Row Style: Fields (Selectable). The Node: NID is excluded from the display.

In this case, it does not return the correct autocomplete - you just get [nid:] returned. If you change the Node:NID field in this scenario to not be excluded, the [nid:123] is correctly populated.

What I am getting at is if your view 'Defaults' is set to Grid and your Node:NID is excluded from display, the [nid:123] is not returned correctly to the autocomplete box.

abaddon’s picture

Title: "Node: Nid" field cannot be hidden in View » "Node: Nid" and node title fields cannot be hidden in View
Version: 6.x-1.1-beta5 » 6.x-1.1-beta6
Status: Active » Needs review

the title field cant be hidden either, some might want this to create another "title" field from several CCK fields, this fixes it

--- nodereference_explorer/includes/nodereference_explorer.views.inc    2009-09-19 14:34:29.000000000 +0000
+++ nodereference_explorer/includes/nodereference_explorer.views.inc       2009-09-19 14:15:18.000000000 +0000
@@ -61,11 +61,12 @@ function nodereference_explorer_preproce
       $vars['row_classes'][$id][] = 'views-item-selectable';
       //get node id for each row, retrieve from result if nid is hidden
       $nid = isset($row['nid']) ? $row['nid'] : $vars['view']->result[$id]->nid;
+      $title = isset($row['title']) ? $row['title'] : $vars['view']->result[$id]->node_title;
       $element = array( //wrap id table fields with radio buttons
         '#type' => 'radio',
         '#id' => 'nodereference-explorer-row-'. $id,
         '#name' => 'nodereference-explorer-row',
-        '#return_value' => $row['title'] . ' [nid:'. $nid .']',
+        '#return_value' => $title . ' [nid:'. $nid .']',
       );
       $row['nid'] .= drupal_render($element);
     }
gnindl’s picture

Status: Needs review » Fixed
FileSize
2.59 KB

The $vars['row'] variable in the field (selectable) preprocess function has information about ALL fields, including the excluded from display.

The patch from #9 is here included as well.

gnindl’s picture

Sorry guys patch from #10 is buggy, got the condtionals wrong. Patch #10 should be considered as obsolete.

Here is the right one for solving #10.

Status: Fixed » Closed (fixed)

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