nodereference does not show saved field during node edit

Ian Ward - February 24, 2006 - 21:47
Project:Content Construction Kit (CCK)
Version:6.x-1.x-dev
Component:nodereference.module
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

I created a content type with a nodereference field. The referenced node saves fine, as it displays the referenced node when viewing the node. However, when I go to edit the node, the entry in nodereference is forgotten - this happens for both ajax and select-list. This does not happen with the userreference type.

Ian

#1

Ian Ward - February 24, 2006 - 22:41

It does propagate the field correctly when you edit the node while the field is set to allow for multiple entries.

#2

JonBob - March 4, 2006 - 20:49
Component:Code» nodereference.module

#3

Egon Bianchet - March 15, 2006 - 14:49
Status:active» needs review
AttachmentSize
nodereference-default-value.patch 1.64 KB

#4

Owen Barton - March 16, 2006 - 10:05

The values were being forgotten for me for multiple selects also.

nodereference-default-value.patch applied and fixed both single and multiple selects - I did not test with an ajax field.

#5

yched - March 17, 2006 - 13:15

Works for me on select widgets (single and multiple)
I updated the patch to make this work with ajax-autocomplete as well.
I tested it on both single and multiple values

AttachmentSize
nodereference.module.patch 2.32 KB

#6

yched - March 17, 2006 - 13:18

I re-read my post and realized it was ambiguous. Let me rephrase:

I tested the first patch, and it did fix the issue on select widgets (single and multiple), but not on autocomplete widgets.

I upgraded the patch to fix the issue on autocomplete widgets as well.

#7

yched - March 17, 2006 - 14:29
Priority:normal» critical

I forgot two lines - it seems that it works without this additional correction, even though I don't understand how... I guess it is caught and corrected by db_query

(it is in both insert and update part, in the case of a non multiple autocomplete widget)

- db_query("INSERT INTO {node_field_nodereference_data} (nid, vid, field_name, delta, field_nid) VALUES (%d, %d, '%s', %d, %d)", $node->nid, $node->vid, $field['field_name'], $delta, $node_field['relation']);
+ db_query("INSERT INTO {node_field_nodereference_data} (nid, vid, field_name, delta, field_nid) VALUES (%d, %d, '%s', %d, %d)", $node->nid, $node->vid, $field['field_name'], $delta, $node_field['relation'][0]);

(added '[0]' at the very end)

(setting the priority as critical, BTW, because it is indeed...)

AttachmentSize
nodereference.module_2.patch 3.33 KB

#8

JonBob - April 5, 2006 - 21:00
Status:needs review» fixed

Should be fixed in current CVS after the nodereference.module refactoring.

#9

Anonymous - April 19, 2006 - 21:01
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.