Skip to main content
Darren Mothersele
London-based Drupal Web Developer
Main menu
Home
Services
Archive
About Me
Contact
London
Categories
Node reference create for Drupal 6 CCK Node reference field
Node reference create for Drupal 6 CCK Node reference field
17th November 2008
Darren
22 comments
drupal
Comments
Hey Darren, great module here.
I would love to enhance this idea by including the entire referenced node form into the main node form.
Use Case:
I have a content type "Song" with a field Lyrics.
I have a content type "Track" with a field Track #, and a node reference to a Song.
When a user goes to create a Track, I want them to be able to either select an existing Song, or create a new Song right there. Your module gets most of the way in that users can create the new Song content type title, but they can't fill in the lyrics.
Ideally I think the node reference field should be an either or: EITHER use the autocomplete text field, OR create a brand new node in a complete node form.
Do you think this is possible? Do you have any ideas for how to go about implementing it?
Thanks for your time!
Sara
Yes, this is possible. There is a module for Drupal 5 that uses a popup window to create the node: http://drupal.org/project/addnode
I've not used the addnode module because it's not available for 6, and I wanted something really basic. In my case it would have been confusing for users to have to create another node and then reference it. That didn't make sense within the workflow for this particular site, I'm also not sure that having a popup window would have helped.
Could you:
1) validate the node reference using an AJAX callback, and using jQuery add in the other node form to create the referenced node? This could be in a modal popup (thickbox/lightbox) to force entry.
2) redirect to the newly created node's edit form on submit.
http://drupal.org/project/popups_reference
I truly love your blog.. Excellent advice &
nice theme. Did you develop this amazing site yourself? I’m hoping to create my own personal website soon.
Kudos!
Stacey
great feature, thanks
Hi,
Thanks for creating a very handy little module. The popups_reference module works well, but is a little complex for my needs, so this is ideal.
A quick suggestion to improve usability - I added a message to the user with links to the new nodes to remind them to finish filling them out:
After this line:
$nid = $newnode->nid;I added:
drupal_set_message(t('Added stub entry for '). check_plain($element['#title']) .': '. l($newnode->title, 'node/'. $nid));... although it strikes me that I should probably sanitize the title used in the link as well.
I would love to see further development of this code. Are you interested in creating a d.o project?
Hi,
I'm using your module and it works great!
Thank you so much!
The D5 version worked just great -- but I upgraded to D6 and find that the node is created but there is no Wikipedia content. Just curious if that aspect is in the works? Is there any easy workaround for this?
There is another module, CreateFromWeb, which extracts Wikipedia and other content, but isn't unfortunately tied to nodereference. There is an issue on this, where I referred to your module ( http://drupal.org/node/387436 )
Thanks again.
Hello there,
thanks for this great module! Works great so far (apart from a possible incompatibility with the links module bundle).
The only question i have is if it's possible to define the content type to be created.
So far i just can see that i can choose the content types to be references.
Best Regards
sonden
It creates a node of the content type that is to be referenced. It uses the first selected reference-able type.
http://drupal.org/project/noderefcreate
Hello, thanks a lot for providing this module.
It creates a node of the content type that is to be referenced. It uses the first selected reference-able type.
What it seems to do is that it takes the content type it gets as the first result from a DB query, which is not necessarily the one wanted. Would it still be possible to add an option to choose the type to create?
My usage scenario:
I'm building a website for a scientific institute, where the staff can list their publications. Every publication can have several authors which are linked to staff profile nodes. But not all the authors are necessarily members of the institute, and therefore they will not all have nodes with their profiles on the site. For those external authors I would like to be able to not mix them with the staff members if possible (only a name is needed with those, and the nodes don't need to be published - in fact, I want to present the names unlinked). Now, when I add a dummy node type for external authors then I seem to be unable to choose that one as the type to create.
Apart from this, noderefcreate seems to work best in my case, out of all the similar modules I tried.
Hello,
I'm using your module and it works great!
THANK YOU SO MUCH.. faiz oranları
Hello!
I'm using your module.
Thanks for creating this!
Works great!!!
Hey Darren,
I'm looking to see if I can extend this module to either work with views (take a view of nodes to reference, with a content type selector to create nodes if none are found), or, alternatively, show an image next to the titles of nodes.
So, if I have an imagefield, theme that through theme_imagecache, and return that alongside the element title. I'm looking at the code and I'm a little confused on how to do this. Would you mind firing me an email with your thoughts? I'm happy to pay you for your time.
Thanks!
-Cameron
Thanks for sharing this wonderful post
Your attachment link goes to a "Page not found" page. Would you be able to fix this?
I'd get your module off of Drupal, except that the Drupal FTP servers seem to be down today.
I would recommend waiting and getting the module from Drupal.org as that will be the most recent version.
thanks,,,,,,,,,,,,,
Did you take the module down, I can't seem to find the link
Hey, this is an old post. The module has since been moved to drupal.org and is maintained by someone else.