I think this is a very nice solution to the problem of adding and referring to a related node, however, I would like to propose the idea of, instead of clicking an "add" button and having the related node's edit form open, having the related node's fields embedded in the relating node's form as a "subform." I think other modules have done this in the past (e.g. http://drupal.org/project/related_subform) and I think it's a pretty elegant solution.
As an example, suppose I have "event" and "location" content types. I create a new event, and for the reference to the "location" node, it allows me to select an existing location (as usual) or, if I choose to add a new location, it embeds the location node's form fields in the event form. When "save" is clicked, both nodes are added (the location node is added first, then the event location is added with the proper reference.)
Does this sound like a good idea?
Comments
Comment #1
e2thex commentedI think this would be a very nice addition (although I think it would be something that should exists along side node embed)
I would add that with d7 making this more general and allowing the editing of any entity type would be really nice. And would add a lot of flexibility.
Comment #2
Stefan Haas commentedVery good idea!
Comment #3
kamenrs commentedThat would be a wonderful solution. +1
Comment #4
AndrzejG commentedsubscribe subscribe subscribe!
Comment #5
r.marino commented+1
Comment #6
jaykainthola commentedHi,
Thanks for your suggestion. I have checked the module and its in drupal version 5. Could you add module for drupal 6.
Thanks
Comment #7
jdufaur commentedsubscribe
Comment #8
geek-merlini'm daring to give this prio, as noone does see a different fix for major issue #1101868: The "add a new" button fails if field is required or has unmatched text right now - feel free to correct.
found a port to d7:
http://drupal.org/project/subform
Comment #9
geek-merlinfound another fix for said issue. look there.
Comment #10
socialnicheguru commented@axel.rutz what is the fix?
Comment #11
geek-merlinsee #1101868-8: The "add a new" button fails if field is required or has unmatched text
Comment #12
wbobeirne commentedI've been working at this issue for the past couple days, and I'm coming to the conclusion that while I imagine this is feasible, it's not a pretty solution and overall just muddies up the way Node Connect handles adding new nodes. Because having a subform would cause the save button to submit both nodes, you don't have much of a window to plug in the nid of the newly created node in to the reference field of the parent node. You're left with 2 choices to do that.
1) Do it after the fact by directly accessing the database
2) Write your own custom form submission function
Perhaps there's a more elegant solution out there, I'm not super handy with how node forms are submitted and maybe I'm missing a simple way to do it. But as it stands, it seems to me that this'll make the existing process of adding a new reference node a lot harder to follow and change in the code. I'd be happy for someone to tell me I'm wrong though.
Comment #13
jygastaud commentedMaybe Field Collection module could be a better we to do that?
Widgets allow you to choose if new form should be open on a new display or be embedded if the current form.