Hi guys,

does anyone know of a way to integrate my taxonomies into my webform select list ?

I have a number of taxonomies and their terms could be ubdated from time to time. So I just wondered if
my users could simply indicate from the webform select list which taxonomy term they are interested in.

Thanks for any help.

Comments

isaakordonez’s picture

Hello, did you find a solution???

I have the same problem...

Thanks for any help...

sisko’s picture

I'm still looking for a solution - I need it urgently too :-)

sisko’s picture

A couple of ways to deal with our common problem.

1) I initially thought I would use trusty jQuery to load all the relevant taxonomy terms via ajax.
The terms will come from a php script reading them from the database.
Then I would use jQuery to insert each option into the relevant drop down list - which I will setup to be empty.

But, when jquery is switched off on the users browser, it will fail as there will be nothing it the dropdown list

2)The second and better option is to use the markup type of webform.
I just found it uses input format including php if you set it up.
So, using php, read the terms from the database and write them as options into a self written dropdown list

I think that should work

Dublin Drupaller’s picture

tap into the webform api using something like this in a custom_module.module.

<?php

function mymodule_webform_select_options_info(){
  
  $items = array();

  $items['neighborhoods'] = array(
    'title' => t('Boroughs'),
    'options callback' => 'webform_borough_taxonomy',
  );

  return $items;
}

function webform_neighborhood_taxonomy(){
  $borough = taxonomy_get_tree(2);
  $items = array();
  foreach ($borough as $item){
    $items[] = $item->name;
  }
  return $items;
}
?>

explanation here: http://www.framlinggroup.com/content/adding-custom-fields-webform-using-...

Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate

marcoscano’s picture

Or you can just use the Webform Term Options module