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.
I was hoping that this would functionality would be in the D7 version of node reference just like in D6, are there any plans for this?
Comments
Comment #1
fgmNo plan for any new feature in D7 until we have a stable 1.0 version equivalent with the D6 versions. Only then can we afford to consider new features, if none of the "designed for D7" moduels like Relation comes out.
Comment #2
geerlingguy CreditAttribution: geerlingguy commentedIn the meantime, is there any way I could populate the field with a default through a
hook_form_alter()
?For example, would it be possible to set a #default_value for the node reference field (or a user reference, for that matter), somehow?:
Edit: I also tried building the reference with an autocomplete text field, but that didn't work:
Comment #3
geerlingguy CreditAttribution: geerlingguy commentedUpdate: I had to set the #default_value in the following way:
It was helpful for me to look at the structure of
node_reference_autocomplete_value()
in node_reference.module.Comment #4
Zachmo CreditAttribution: Zachmo commentedWould love to see this implemented some day!
Comment #5
Sol Roth CreditAttribution: Sol Roth commentedI also require this feature and will be using hook form alter in the meantime.
Comment #6
OFF CreditAttribution: OFF commentedgeerlingguy, thank you!
Working prepopulate node reference fileld with node clone module:
Comment #7
thommyboy CreditAttribution: thommyboy commentedi would need that too- in d6 when only ONE value was available for the dropdown this one was selected by default- right now there is an "- Select a value -" option selected as default :(