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
It does propagate the field correctly when you edit the node while the field is set to allow for multiple entries.
#2
#3
#4
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
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
#6
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
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...)
#8
Should be fixed in current CVS after the nodereference.module refactoring.
#9