2

I have 2 content types, person and date. Date have a relation with person, in one node of person, you can see the dates of that person.

I want add a link in the nodes of person for add a date for that person (this is easy), i need pass the id of the person node automatically to the new node of date.

I don't know how to do this, anyone can help me?

Thanks.

EDIT:

Will try to explain it better:

I use node reference module for create the relation between the two content types. When i add a node of date, all fields are in blanc, if i add one date node through node of person, the id of that node, will add automatically to the new date node in the field that relation the two content types.

1 Answer 1

1

One easy way to do this is with the module

nodereference_url

The Node Reference URL Widget module adds a new widget to the Node Reference field type. It auto-populates a node reference field with a value from the URL, and does not allow this value to be changed once set. It can automatically provide a link on the referencing node types, that will contain the proper URL to prepopulate the field.

4
  • I forgot to say that I am already using that module. thank for the answer.
    – Carroca
    Oct 28, 2013 at 21:13
  • Are you using nodereference_url for the form widget? (different from the nodereference module only) if so, that should work fine. Oct 28, 2013 at 21:30
  • 1
    Yea, sorry, I read the wrong name of the module, i read nodereference only xD, is it about the fatigue. Sorry.i going to try with it.
    – Carroca
    Oct 28, 2013 at 21:59
  • I solve it. I use nodereference_url module, and the custom url is created with this php code in a block and put the block in the person content type: <? if ($node = menu_get_object()) { $nid = $node->nid; $name = $node->title; } ?> <a href="<?php print url('node/add/cita/' . $nid); ?>">A&ntildeadir cita a <?php print($name);?></a>
    – Carroca
    Nov 5, 2013 at 18:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.