This is an incredible module and so gald to have stumbled across it a few days ago.

However, when I create and reference a node, when I return from my modal page, I have 'ant [nid:1234]' in my text box - ie, the correct new NID, but the 'ant' text prefix. Many of my text/autocomplete woes have been down to Devel, but disabling this had no effect.

Any thoughts?


markus_petrux’s picture

Title: Create and Reference Function Breaks » Add support for Auto Node Title
Category: bug » feature

Yep! This is because you're probably using Automatic Node Titles (ANT), and "Create and reference" is reading the title of the node from the form, but ANT generates the title later. Anyway, I think you can still submit the node form, and the correct node reference will be taken.

I need to think about a workaround here, so that we can still show the correct title somehow.

PS: Better issue title a switching to f.r.

markus_petrux’s picture

Status: Active » Needs review

hmm... how about this?

Edit and apply this mini-patch:

 function _noderelationships_child_node_form_submit($form, &$form_state) {
+  $node = node_load($form_state['nid']);
     'operation' => 'updateSingleValue',
-    'value' => $form_state['values']['title'] .' [nid:'. $form_state['nid'] .']',
+    'value' => $node->title .' [nid:'. $form_state['nid'] .']',
snorkers’s picture

That's exactly it...! I had forgotten I'd set up the related node type to use Auto Node Title. Your little patch works fine... haven't tried it it yet on a non-ANT content type, but will try it soonest.

Thanks for looking into it so quickly.

markus_petrux’s picture

When this submit handler is invoked, node_save() has already been executed, so if this mini-patch works it should cover ANT and any other module that alters node data during nodeapi('presave'), nodeapi('save'), etc. :)

Will commit this asap.

markus_petrux’s picture

Title: Add support for Auto Node Title » Add support for Automatic Node Titles
Status: Needs review » Fixed

Committed to CVS (patch). Thanks for reporting and testing (so quickly too). :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jday’s picture

Version: 6.x-1.0-beta3 » 6.x-1.x-dev

when using the 'create and reference' link the new referenced node does not have the automatic node title but the token field names instead ([field_first_name-raw] [field_last_name-raw] [nid:388913])