Posted by boris mann on July 14, 2008 at 10:30pm
I'm aware of:
- Subform - http://drupal.org/project/subform - 4.7
- Add and Reference - http://drupal.org/project/add_n_reference - 4.7
- Addnode - http://drupal.org/project/addnode - 5.x
- Noderefferer Create - http://drupal.org/project/nodereferrer_create - 6.x available, depends on nodereferrer which doesn't seem to have 6.x available?
Addnode and Nodereferrer look like the leading candidates, and assuming that NR is going to be available for D6 soon, I'd use that. BUT, creating items on the same form page as Addnode does seems the most elegant.
Have people had experience with this, and any info on availability / suitability for D6?

Comments
Prepopulate
We used prepopulate in D5, and there is a D6 version currently out -- http://drupal.org/project/prepopulate
In D6, with views2 built in support for backlinks, a combination of prepopulate/nodereference/views would get the job done for most cases.
FunnyMonkey
Tools for Teachers
FunnyMonkey
Not prepopulate
Maybe I did a bad job of mentioning my requirements.
I would like to have a Person content type, which has a Related Companies nodereference field. Right now, I have to go off and create the Company node, then come back and fill out the nodereference
How do I, in Add Node or Subform style, create/add that Company node object without having to pause filling out the Person node form I'm currently in (D6)?
Nodereferrer_create has code available for D6 and looks second best to Addnode, but depends on nodereferrer, which only seems to have D5 code available....
Aside: Node2Node (http://drupal.org/project/node2node) looks very promising, but also doesn't create on the fly.
/me laments -- my kingdom for one solid way of doing bi-directional relationships AND on the fly creation of content...
New Widget "Node select" for CCK references
You can test it here on the demo site :
http://lab.france24.com/
Thanks
...but it doesn't, at all, let you add new nodes to be referenced.
Looking for a solution to
Looking for a solution to this problem myself in D5. I'm essentially modeling a site for Martial Arts.
Group | Locations | ClassesIn order to create a Class, first the Location must be created. Each Location can have many Classes.
In order to create a Location, first the Group must be created. Each Group can have many Locations.
This is essentially the problem Boris is trying to solve. He wants to be able to create all the parent nodes from the Child Node Create Page.
I will need to solve this problem with my upcoming site. Currently I'm dreaming up two solutions.
Method 1: Thickbox and some Ajax
Provide user with dropdown of all current existing parents. Also provide a link beside the drop down to add a new one. Load the Node-Create form in a custom page which will be loaded in Thickbox. On successful submission of Thickbox node create form, add new entry into dropdown and select it. While this is rather simple, I think the interface is rather confusing.
Method 2: Tabbed node creation form
Make a tabbed create page, where you start off with the parents and work your way to the child you want to create.
Tab1. Take my previous example of Martial Arts. Let's say I want to create a class and click on the appropriate link. I will be presented with a form where I can either choose (from dropdown) or create a Group. Once that's done, I move onto Tab 2.
Tab2. I am presented with a page to either a currently existing Location (from the Group I previously chose or created) or create a new Location. After this is done I move to Tab 3.
Tab3. Create my class for the Group and Location i've previously created or chosen.
I prefer this approach as the UI is better, but it will take some extra clicks. This could be greatly enhances with submitting the forms and changing tabs with ajax (not something i'm planning to do myself).
Again, these are just ideas I'm playing with for my project, nothing is implemented. I'll probably go route 1 for now for simplicity.
Question for Boris. How are you planning to define which nodes have to get created before a particular node can get created. What if what you are referencing requires a parent itself?
Vancouver Events & Music community
Freelance Web Design
Drupal & Commerce Themes
Related nodes, not parent nodes
If you're developing on D5, then go ahead and use AddNode or Node Referrer -- both are excellent solutions, they just aren't ported to D6 yet. I prefer Node Referrer, because of my desire for two-way links, but Addnode inlines additional node creation forms, which is nice.
Answer: I don't have any required fields (these are all cross references of related info -- it's nice to have not must have). Multiple add and reference instances end up getting difficult, and I would work with something that inlines node creation forms as needed -- which is what addnode does. So, it's not parent nodes, it's related nodes.
I have been thinking about
I have been thinking about taking a swing at this one with the popups module, but wanted to do due diligence and see what other solutions already exist. Thanks for listing them.
Addnode abandoned?
I had tried addnode a year ago and gave up after experiencing too many bugs. Looks like the project is unmaintained and there are numerous bugs in the queue with no response.
Given this, do you still think it's a good option Boris? I haven't tried nodereferrer create yet, but that's my next stop.
Good options
I was commenting purely on UI functionality, I didn't dive into the maintained status. Nodereferrer isn't all too well maintained either, however, so I would recommend joining forces and picking one. It looks like nodereferrer is architecturally a little better built.
Solved
Well, not by me, but by my friend. He's too lazy to post what so many people have been looking for, so I'm going to post his code, and hopefully questions will get answered too.
We're working on a mock-up CRM for my Dad's law office. we have a Contact and Matter node-type. The Matter nodereferences the Contact. Our solution was to be able to add a matter that references the contact while looking at the contact.
We use this solution for several node-add forms that automatically pre-populate the node-reference of the node you're looking at, like this:
We have an "Add to Contact" block.
The block visibility is set for: Show if the following PHP code returns TRUE
and the php code is:
<?phpif (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) != 'edit' ) {
$node = node_load(arg(1));
if ($node->type == 'contact') {
return TRUE;
}
}
else {
return FALSE;
}
?>
I don't know what it means, but I get the idea of how it works, so feel free to ask questions. Here's a screenshot as well:

<a href="http://img604.imageshack.us/content.php?page=blogpost&files=img179/1072/mdtlawgh5.png" t
The part I forgot
The default value for the nodereference field on the Matter node-type that references Clients is this php code:
if (arg(0) == 'node' && is_numeric(arg(1))) $nodeid = arg(1);
else ($nodeid = 0);
return array( 0 => array('nid' => $nodeid));
Well, that code doesn't
Well, that code doesn't really tell us much - just when to display the add&reference form. :-)
It's a nice interface for adding and referencing small bits of content, but for someone who needs to add and reference a node with a lot of required fields, a popup-solution seems like a better option. It also doesn't provide a smarter way than the standard nodereference widget to reference existing content (like the france24 solution does).
Lots of good ideas here though.
nodereferrer for D6
There's a patch that ports the main nodereferrer functionality to D6 (missing is views handling) here : http://drupal.org/node/259837 and nodereferrer_create works when using this patch.
I promised to finish porting nodereferrer for D6 (the main maintainer seems to be pretty busy) before October, so watch this space :)
nodereferrer for D6
Porting is finished :) It's not been reviewed by the maintainer yet (so there's no release), but you can download the whole Nodereferrer for D6 module here : http://drupal.org/node/259837#comment-1017574
Popups: Add and Reference
Ok, I have released my version of a solution to this problem for Drupal 6. It is called "Popups: Add and Reference", and an alpha is available over at http://drupal.org/project/popups_reference
Testing...
I have an issue I'm typing into the queue right now, but ... I like. Thanks, this is easier and less data intensive than node_refer (although I would like to see two way links made easy). I think this solves what I need for now!
two way links
nodereferrer_create for Drupal 6 provides two way links. It adds an extra menu in the view page (a local task with sub menus) that lets you create any related content - whether it's a reference or a referrer. It supports CCK multiple values, so you can build one-to-one, one-to-many or many-to-many relationships. It also lets you pre-populate the new form with data from the existing form.
It works well - I'm using it on a medium size project which integrates a database - and it's easy from the user's point of view ; but I wouldn't say it's easy from the developers' point of view though - you need nodereference, nodreferrer (with a patch for D6) and nodereferrer_create (no docs yet, sorry). Also, on a more fundamental level, there is something un-intuitive about using nodereference for two way links, because it's linked firmly to one side of the relationship ; and the downside of nodereferrer_create is that the creation is based on the view page rather than the edit one.
From this experience I can say that a good two way link solution wouldn't be based on nodereference. It would require a different CCK field type where you explicitly define both end of the relationship and how the relationship works. Having popups from the edit page is a pretty neat idea to get around the editing problem. I'd be quite keen to work on such a project ; a module to help people build simple databases with Drupal/CCK/Views. Anyone would like to join forces/discuss this further ?
I'm also very interested in this
I think your analysis of there being a need for a new CCK field type is quite possibly correct.
I just posted a question that bears directly on this, I think. (http://groups.drupal.org/node/19093)
I have developers that I can commit to this if necessary, but I want to get a better understanding of what is available before I decide how in-depth to try to go on this.
Have you given it any more thought?
Pop-Up Add & Ref + Node Ref URL Widget?
It seems like the two-way reference could be solved by using Popup Add & Reference with the functionality of Node Reference URL Widget?
I don't know how this would be done programmatically, but basically you'd have to add the node id to the end of the add child url that brings up the pop-up window.
So, for example, right now if I want to add a child node to my parent node (with nid=12) I click on the link in the edit screen of the parent and the url is:
http://example.com/node/add/child?destination=node/add/parent
Instead, could we add the parent nid (12) so that we get the following, which adds the parent node to the child's node reference:
http://example.com/node/add/child/12?destination=node/add/parent
prepopulate question
when using prepopulate, what is the exact syntax that you need in the nodereference field. is it simply the NID?
Taking this thought to the next functionality step, does CCK and Views use backlinks to list the various NID connections found within the CCK Node Reference field?
figured it out
I realize my above post wasn't that intelligent. Some testing showed that the Node Reference just needs the NID and then the backlinks work properly.
Node Relationships module
Here's a new option that provides this functionality: The Node Relationships module is based on the Modal Frame API (rather than Popups API) and it provides a few more enhancements to node reference fields: Create and reference (to enhance the search and reference feature), Search and reference with support for single and multiple selection for multiple value fields (automatically updates the multiple value widget with as much items as necessary), and it also provides "Automatic back references" based on customizable views, and a basic entity relationships diagram to walk all the relations defined in the system.
The "Search and reference" and "Automatic back references" features are based on dynamically configured views. While default views are provided, they can easily be modified and/or cloned (recommended) to add more fields, filters and so on.
I have written this module per request and it tries to provide a single solution to cover almost all needs related to node relationships management, easy yet powerful to customize from a single interface. All these extensions are managed from a new tab "Relationships" added to the content type management screens.
I hope it can be useful to others.
Node Reference Create
http://drupal.org/project/noderefcreate
I had the same problem and
I had the same problem and found a solution with CCK fields only.
http://drupal.org/node/564164#comment-2077200
The best one I found for D6
After testing all of the said modules,
the best one I found to resolve this was Popup Add & Reference with the Corresponding Node References by its side to provide it with two-way relationships.
What about content transfer?
This sounds really interesting so far.
How to solve the following issue: I have a node type called Event requisition (ER) with 2 possible dates in it (e.g. Friday 9pm or Sunday 8pm). Now I want to fix an appointment based on that ER and use the Friday 9pm.
How could I create a referenced node with that date prefilled?
I was thinking of Autocreate Node Reference and Node Reference URL Widget for the node relation and but which module to transfer the date?
You may want to check Node
You may want to check Node Widget:
http://drupal.org/project/node_widget
hey antonio, nice module.
hey antonio,
nice module. really good for integrating the related node creation in a node.
Unforetunately, this was not exactly what I was looking for. I am look for a module which is prefilling fields by a referred node.
So to sum up...
Here are all the currently supported modules that could be used to solve this problem:
http://drupal.org/project/prepopulate
http://drupal.org/project/node_widget
http://drupal.org/project/autocreate
http://drupal.org/project/noderelationships
http://drupal.org/project/cnr
http://drupal.org/project/nodereferrer_create
http://drupal.org/project/noderefcreate
http://drupal.org/project/relativity
http://drupal.org/project/popups_reference
I feel like this is a little excessive, but then this both a common and potentially difficult problem to tackle.
(BTW, I've added a few I forgot originally.)
Complete solution:
Complete solution: http://drupal.org/project/noderelationships
(check Node reference extras)
The same problem
Hi. I need a module to populate automaticly a CCK field. I´ve created a profile with node_profile including a email field, i need to display that email field in the content of another node, the email of the user who create it. how can i do it?
Thanks to all
One solution
May not be exactly what your looking for
http://drupal.org/project/prepopulate
But with a custom link, you can get the desired functionality
Best solution I've seen is nodereference_url + views_attach
I was hooked when I watched http://mustardseedmedia.com/podcast/episode37 and http://www.lullabot.com/articles/photo-galleries-views-attach
Following this recipe, once your parent node is created, you then get an "Add [whatever child node]" link, and the newly created child nodes get displayed right below this parent node.*
Node relationships and node
Node relationships and node widget work good.. Node Reference URL Widget is a good to go as well.
Anything like this for D7?
I can't seem to find a single project that contributes this functionality--nodereference & create/add for Drupal 7.
I'm really hoping that I'm just not finding it... any ideas?
plus 1
It's of big interest here, too. :)
I think you are searching for
I think you are searching for http://drupal.org/project/references_dialog
The following modules both
The following modules both work with http://drupal.org/project/entityreference which is now the de-facto go to for Drupal 7 references.
http://drupal.org/project/entityreference_prepopulate
http://drupal.org/project/inline_entity_form