I have a "person" content type that uses two node reference fields: one to point to a "spouse" person, and the other to point to a "child" person; i.e. these are all "person" content types. I'm viewing a specific person content and I use the link configured by Node Reference URL Widget to "add a spouse." When the new content is created, the spouse node reference field is prepopulated with the specific person link, but so is the child node reference field!
It seems to me that only the spouse field should be updated when I use the spouse link, and only the child field should be updated when I use the child link. However, in both cases both fields are being updated.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | nodereference_url_alt_format-d6.patch | 4.4 KB | quicksketch |
| #6 | nodereference_url_alt_format-d7.patch | 4.28 KB | quicksketch |
Comments
Comment #1
tgshannon commentedThis are my field setups.
field_mother
Label: Mother
Widget type: Reference from URL
Fallback behavior: *
Use autocomplete widget
If no content is referenced in the URL, determine how the form should be handled.
Use fallback behavior when editing content
create link on full view
link title: Add child
return path: the new node (no redirect)
field_spouse
Label: Spouse
Widget type: Reference from URL
Fallback behavior: *
Use autocomplete widget
If no content is referenced in the URL, determine how the form should be handled.
Use fallback behavior when editing content
create link on full view
link title: Add spouse
return path: the new node (no redirect)
Comment #2
quicksketchHm, I'd agree that this is unusual behavior. This module wasn't really designed to work with more than one node reference field on the same content type. Note that you can work around this issue by using a module like Custom Links, and instead of making links like
node/add/[type]/[nid], you can make links tonode/add/[type]?spouse=[nid], and Node Reference URL Widget will pick up the relationship that way. Read the README.txt for more information on this approach.So this definitely still qualifies as a bug, but one that you can work-around relatively easily. Perhaps the solution for Node Reference URL Widget is to make the automatically-created links follow this same pattern when more than one node reference field is on the new node type.
Comment #3
quicksketchA similar issue: #805364: Node Reference URL widget with three nodes?.
Comment #4
henrijs.seso commentedjust to make life easier, lets change default pattern like ?field=[nid]. Im not big fan of idea thou, since field names are 1) usually ugly and 2) could tip off some setup architecture, naming convention or pattern and therefore be security hazard
Comment #5
quicksketchThat sounds like a good idea to me, but I think we should only take that approach if there is a reason to use that format (such as if there are multiple fields). I personally like the "short" format unless there are unusual circumstances.
Comment #6
quicksketchI've committed these patches to address this problem.