Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
Thanks a lot for usefull module.
But, when I create base-related content, how to make Node Reference field become filled with relevant (just created) reference on popup close.
Thanks
Comment | File | Size | Author |
---|---|---|---|
#22 | bug-report.gif | 16.2 KB | orniter |
#21 | 308589-nid_in_noderef_field.patch | 511 bytes | greg.harvey |
Comments
Comment #1
starbow CreditAttribution: starbow commentedThe module does not select the newly created node for you, it just adds it as a possibility. You still need to select the new node after creating it.
Comment #2
starbow CreditAttribution: starbow commentedComment #3
kswan CreditAttribution: kswan commentedHow difficult would it be to add this functionality? I am starting to look into it and I hope I can figure it out, but I am pretty weak at JS.
Would it work to add an AHAH callback to the nodereference widget on the base form, then make the appropriate callback after submitting the popup form? Of course I am glossing over a lot of details that I don't understand, but I am on the right track?
Comment #4
starbow CreditAttribution: starbow commentedI doubt AHAH will help you. The trick is you need to determine the nid of the newly added node to be able to select it, and I am not sure where that into is available.
Comment #5
meba CreditAttribution: meba commentedForgive me for any misunderstanding, I haven't seen the module live yet, my friend just asked me to comment on this issue as he is trying to solve it too :-)
As I understand, this module creates a popup presenting node add form during editing any other node, useful for Node reference.
What I would do is add a GET parameter to the popup page (Such as node/add/page?popup=1).
Based on this, I would alter the node form to include this parameter in a hidden field, using hook_form_alter. (Or include it as a field in the node form)
Then, I would use hook_nodeapi with $op = insert and based on the popup value, I wouldn't permit Drupal to load & view the node, but just print a javascript which fills the original node form and exits.
Does it make sense?
Comment #6
scottrigbyHi starbow,Along similar lines, but not quite as involved--- Is it possible to just see the created node in the node-reference list after popup node creation?
Here's what happens for me:
* I click 'Add new' link
* Node is added (yay!)
* Modal redirects to create content, which I want to close
* After closing the popup, my newly created node does not appear in the node-reference field. I have a multi-select.
Is this by design? I assume it isn't because it kid of defeats the purpose of add & reference. Kind of only 'add' but can't reference :(
I tried with 6.x.1.x-dev and 6.x0-1.0-beta1, with similar results (the only difference is, in the dev snapshot the create content window is not called, but another node of the same type we're originally in... the parent node containing the node-reference). So i'm guessing it's not the version - maybe something with my configurations?
I'm hoping to find out what I must be doing wrong though, because this module would really solve a lot of my dilemmas ;)
Edit:
Ok - moved to separate bug report: #332459: Created node doesn't display in node-reference list after popup node creation
Comment #7
starbow CreditAttribution: starbow commented@scottrigby: what you are describing sounds like a bug. It should be behaving like you expect. You should open a separate issue.
Comment #8
starbow CreditAttribution: starbow commented@meba: if that approach works, please post the code. Don't forget you still need to reload the new form element into the original page.
Comment #9
starbow CreditAttribution: starbow commentedThe feature will be included in the next release, which will be 1.0-RC1. It will require the next release of the popup API, which will be 1.2-RC1
Comment #11
cYu CreditAttribution: cYu commentedCan the following line be changed in order to stay consistent with how autocomplete nodereferences display? I believe I'll need this for #393002: Edit Node reference so that I can get the nid for both newly created and existing nodereferences, although I was hoping there would be a better way to do so besides pulling it from that string.
to
Comment #12
starbow CreditAttribution: starbow commentedIf this change does not break anything, I am happy to put it in.
Comment #13
starbow CreditAttribution: starbow commentedComment #14
sirkitree CreditAttribution: sirkitree commentedI was using this in a similar way on my site. I didn't come up with a cookie based solution - more traversing the DOM to construct this and then placing it as the value purely in javascript, but if a user is using the autocomplete widget it's very important.
Comment #15
sirkitree CreditAttribution: sirkitree commentedTested the above and it works just fine for autocomplete, but I'm not sure that it's going to work for other widgets...
Comment #16
cYu CreditAttribution: cYu commentedThe other widgets don't use the title, they only use the nid, so this should not affect them.
Comment #17
sirkitree CreditAttribution: sirkitree commentedWell that's my point: the other widgets just use nid. So if we're always returning title[nid:#] isn't that going to screw up the other widgets? I'm suggesting that we may have to detect which widget is being used in order to determine what to throw back at it.
Comment #18
cYu CreditAttribution: cYu commentedThe other widgets should be ok, they use a different variable that stores only the nid which is pulled from a separate cookie.
Comment #19
starbow CreditAttribution: starbow commentedcYu is correct. The nid and the title are stored separately.
Comment #20
russbollesjr CreditAttribution: russbollesjr commentedsubscribed
Comment #21
greg.harveyPatch for #11 attached.
Comment #22
orniter CreditAttribution: orniter commentedAnyone know if this behavior is corrected? I'm having the same issue as original post:
Adding a node is fine, the popup confirms the reference was added, but the reference field isn't auto-filled with the new content.
Attached screenshot details this problem.
Any information would be greatly appreciated!
Comment #23
momper CreditAttribution: momper commentedsubscribe
Comment #24
snufkin CreditAttribution: snufkin commentedIt looks like it only skips the first popup, for every other it works fine for me with the patch.