3

I would like to have the title field of specific Nodes from a Content Type show up in a Select Box on a Webform. Technically, it should not grab all of the nodes titles of that content type, it should only grab specific ones (that I'll need to mark somehow), so am thinking I'll need to create a vocabulary and assign this to the nodes somehow, but than I'd like to be able to use this taxonomy term to grab the titles of these nodes only. Is this even possible? Is there a module that ties into the webform that can do something like this? Or perhaps a better way to go about doing this?

0

Depending on your requirements could try drupalising your webforms a little so that you could use all the lovely field based modules.

If you elected to use entity form, instead of webform, then you should be able to use a normal entity reference field or a views derived field (eg entity reference view widget) on your form.

0

Webform Views Select is what you are looking for. Set up a view to show the titles you want, and then configure a Webform select list to pull in that view.

This project is just now transitioning from a sandbox project, but I found it works great for this use case!

0

OPTION 1

You could also use the Webform References module. It can provide you with a select box where you can list nodes, terms or users.

OPTION 2

As autopoietic suggested, if you haven't established your site's structure to use Webforms then maybe you can use the Entityform module which is also geared for Drupal 8 and may be easier to maintain and future proof.

OPTION 3

If you don't mind altering things, you only need the title, and creating custom modules you can:

  1. Add a field into your content type maybe a checkbox or whatever you're preferred structure is.
  2. Use hook_form_alter to add a field into your webform and create a custom query that lists the nodes you want to display on the select box using the content type's field you added.
  3. Create a text field on your webform that is hidden
  4. Add a custom submit callback to webform that gets the title/data from the field you added in hook_form_alter() and set your webform's title field value with the selected node title.

Here you could also store the node's ID just to reference it in Views or something.

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