I'd like to be able to add user and node reference fields right into the webform.

I'm using a standard webform I've created as a survey asking questions about past events on the site. The only way I can have a list of events in the webform now is to have a 'select' list and keep updating it with events that have ended.

Members fund testing for the Drupal project. Drupal Association Learn more


mdowsett’s picture

I just want to keep this active....I have another site that needs this.

aaron’s picture

http://irolo.net/drupal_webform_and_dynamic_checkboxes seems to have a good start if anyone wants to take a crack at this

aaron’s picture

Version: 5.x-2.1.3 » 6.x-2.x-dev
twilliac’s picture

I think this is the similar to my issue. I want to create a webform that allows a user to select from a group of pages (content types) that users can add to (sort of wiki-like). When submitted I think I can then use the see own submissions module to allow them to download the list of pages in teaser format (or selected fields). I think using the node reference would work for that but I'm not sure.

Is there anyway this would be possible using webforms or maybe views?

vasike’s picture

5.74 KB

there it is a module for node reference, cck (node reference) dependent.

please copy the nodereference.inc file from this module folder to webform/components folder.

Lekri’s picture

Is there any way to select multiple values, i've been checking out the nodereference.inc file, there is the function but it is commented out, i've tried to enable it, after this i get the choice for checkboxes, butin the form i get the autofill in field.

mdowsett’s picture

I think I'd want a 'view reference' option in the webform...that way I could could have a view of all past events listed in that field, which would change as time went on....is that possible?

quicksketch’s picture

Title: user and node reference fields » User and node reference fields
Version: 6.x-2.x-dev »

Moving to 3.x version, no new features are being added to 2.x.

shadowx’s picture

Version: » 6.x-3.0-beta5

I trird to install the patch file and move the nodereference.inc to components folder, but it seems not work. Maybe it is not yet supported by 3.x version. Has any plan to be included in 3.x version? I think it is an useful feature.

tomsm’s picture

I need this feature too, especially add node references to a webform. Great idea!

quicksketch’s picture

This would largely be solved by #767290: Allow Views to be used as pluggable select list values. Just use a select list powered by Views as your Node Reference field.

dpalmer’s picture

Hi all, I tried installing the webform_nodereference module that was posted in comment #5 but unfortunately I don't see this new field available in my web form fields?

tomsm’s picture

I hope that a CCK node reference field can be added to a webform. Then the module "Node Relationships" can be used to open a view (in a iframe, see module Modal Frame) to search the desired node. I think that this a great way to select node(s).

Node Relationships: http://drupal.org/project/noderelationships
Modal Frame API: http://drupal.org/project/modalframe

aaronbauman’s picture

Version: 6.x-3.0-beta5 » 6.x-3.x-dev
170.97 KB
68.38 KB
2.87 KB

I created a proof-of-concept version of webform nodereference for 3.x that uses the API to implement select or radios/checkboxes using a view-based nodereference-type component on the webform. This was sufficient for my purposes.

Install the attached as you would any module.
DO NOT put it into the webform directory structure.

marking #875174 a duplicate of this issue.

aaronbauman’s picture

Status: Active » Needs review
retool2’s picture

Status: Needs review » Needs work

form result, also email, show node id instead of node title
I've change line 212

$options[$key] = $element['#type'] == 'select' ? $value['title'] : $value['rendered'];
$options[$value['title']] = $element['#type'] == 'select' ? $value['title'] : $value['rendered'];

DrupT’s picture

does #14 work well with 3.2? I would actually need a user reference field in webform. are there any other suggestions?

chrislabeard’s picture

So is this working? I've installed and enabled and got nothing in my select type field.


chrislabeard’s picture

Got it working, But is it possible to pull in another field as the value? Or have it set up just like the select list is where you can do key|safe word.


scotself’s picture

definitely a needed functionality...seems like the module aaron did just exposes the default display of each view. also found this notation, which is good to know.
"Only 'node' views that have fields will work for our purpose."
So it seems to me that if you want to use an existing views display you don't want to modify that's got fields but isn't the default display that uses fields, you have to create a separate view for this to work? correct me if i'm wrong.

scotself’s picture

just an FYI for the maintainer, there is a great module uc_node_checkout that rszrama contributed that manages to make all views displays available to the module...not sure how it was accompished (not a coder) but it might be something to look into. great news is that i've got this working (so far) with no errors with webform 3 and uc_webform_panes! i'll update if i run into any problems with this combination.

BrightBold’s picture

Patch in #14 works beautifully on 6.x-3.x-dev (downloaded 9/22/2010), with the caveats in #20. Just what I needed, thanks!

Also, if you want to make the Webform Validation module (http://drupal.org/project/webform_validation) compatible with this patch, just add 'nodereference', to the appropriate component_types array(s) in webform_validation.validators.inc.

I used this combination to create an event registration webform that allows you to choose first- and second-choice workshops for each session, but fails validation if you select the same workshop twice.

Thanks for rocking out some excellent new functionality, Drupal community!

BrightBold’s picture

+1 on altering the code as suggested in #16. Otherwise any confirmation e-mails, etc. provide the NID, which is not too useful. When I made @retool2's change, it behaves exactly as you would hope.

Exploratus’s picture

subscribe ++++++++++

mogop’s picture

Version: 6.x-3.x-dev » 6.x-3.1

Any help how to achivie these:
* choice automatically the referral product from the list of products (having a lot of products is confusing for the user)
* in the submission to have the name/title/link for that product instead of it's NID

aaronbauman’s picture

Version: 6.x-3.1 » 6.x-3.x-dev
Status: Needs work » Needs review

Figures that now I find the Webform Viewreference module that seems to be somewhat more robust than patch #14.

Webform Viewreference doesn't seem to be actively maintained however - 10 open issues, last commit 41 weeks ago.

Does it make more sense to fold this into webform core, or for Webform Viewreference to stand alone?
Any thoughts?

quicksketch’s picture

Yes it does make sense to include Views-as-select-list as an ability directly in Webform. That approach is much more likely to be included than user and node reference fields. See #767290: Allow Views to be used as pluggable select list values.

Stomper’s picture

Glad to see work on this much needed feature. I need to correct a "contact node author" webform, thus I need to be able to reference the user (author) and the node in question.

locomo’s picture


quicksketch’s picture

Status: Needs review » Closed (won't fix)

I don't plan to add either user or node reference fields directly to the Webform project. As noted, they can be added in a separate module similar to Webform Viewreference, but I'd probably go a dedicated-component approach like the patches in #14. If anyone takes up the cause to maintain this module separately from Webform, please post a link here for reference.