Create Referenced Nodes On-The-Fly

If you use CCK's Node Reference field often, then this tip is for you.

Occasionally I run into the situation when I start adding a new node that contains a Node Reference field only to get half-way through before realizing that the node I want to reference doesn't exist yet. At that point I have to stop what I'm doing, open a new browser window, create the node I want to reference, then reload the original node's "add" form. What a hassle.

Fortunately, with a little snooping around, I was able to find a great little module called Node Reference Create. This gem is a new widget for the Node Reference field that displays as a standard autocomplete text field with one special feature. If the node you want to reference doesn't exist, it will create it for you! When you submit the node/add form, this module will create a new, empty (other than the title which will be populated by whatever you entered into the Node Reference autocomplete field) node that you can go back and populate when you're ready.

But wait, there's more...

Let's say you don't want to have to go back and populate the referenced node later on - check out the Popups Reference module then. It uses the PopupAPI to popup a node/add form for the node you want to reference!

Regardless of which module you choose, your days of jumping around from node-to-node to create references are over.

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!