By nanthony on
I am attempting to have a node field (using a node reference field) that automatically populates using an argument. The correct field displays based on the value in the url but I am wondering how to retain/save that field with the node.
(bad explaination...please see below)
Comments
More expansive explaination of what I am trying to do...
I have various sections, each with stories. I created a custom admin page that displays content for each section and uses arguments to populate the page content based on the node nid for the given section. I have an option to add a story, but the story being created needs to be associated with a given section. So if I am displaying Section1 and click the option to add a story, I want it to automatically be associated with Section1. When Section2 is being displayed, clicking the option to add a story would automatically associate the story being created with Section2...and so on.
I have been playing around with arguments and I can get the node field to display the current section name (node title for the section) but it does not save with the node. The field is blank when you open the newly created story. How can I retain the value being dynamically generated from the argument in the url?
You can use the Node
You can use the Node Reference URL Widget, depending on what "displaying Section1" means the module may be able to generate the link for you or you may need to construct it yourself but it will handle setting the value for the node reference field.
YES!!!
That is exactly what I needed! Much thanks!!!
One Problem...
When I go back in to view/edit a story a created utilizing the Node Reference URL Widget, I get errors when I attempt to save the story again saying "found no valid post with that title" and "this post can't be referenced." This is referencing the field that was auto-populated using the Node Reference URL Widget.