Hi,

I'm new to Drupal, I'm loving it, but I've hit a bit of a wall with adding a list of taxonomy items, (just the strings), to a webform select component.

Anyone have any ideas?

Also, if this is not the right place/way to ask this question please let me know!

Thanks in advance.

Comments

sutharsan’s picture

I want to know this too! I need to ad a taxonomy select list (or a select list with tags) to the webform. Manually adding the terms to a webform select list is no option.

sutharsan’s picture

Title: How Do I Add A Taxonomy Term List To A Webform Select Component? » Add A Taxonomy Term List To A Webform Select Component
Category: support » feature
Status: Active » Needs review
StatusFileSize
new13.48 KB

Based on select.inc I have made an include file to handle taxonomy tags. Code is tested but only for my (limited) use of taxonomies.

goose2000’s picture

Wow, thanks - I'll try it out; Do we need to patch the select.inc with this file or is this a new webform include (component)?

sutharsan’s picture

This patch will create a new file: components/vocabulary.inc. select.inc is untouched.

summit’s picture

Hi,

Could this patch be updated for webform 5 1.7
The values of the vocabularies are not saved when I tested this.

Taxonomy support for webform is a great + for me, so please update the patch so it works with webform 5 1.7!
Thanks in advance,
greetings,
Martijn

summit’s picture

Version: 5.x-1.4 » 5.x-1.7
Component: Miscellaneous » Code

I think this would really benefit webform. Please add it to the newest version.
If it's working..
greetings,
Martijn

summit’s picture

Category: feature » bug

Hi,

I got the following error on this code:

PHP Fatal error:  [] operator not supported for strings in 
/public_html/modules/webform/components/vocabulary.inc on line 151

The mail I got back when using vocabulary support in webform.module gives back blank terms:

Regionaal:
      • 
      •
Rubrieken:
      • 
      •

Where "Regionaal" and "Rubrieken" are my vocabularies.
Does anybody know what is wrong with this vocabulary.inc?

The complete code is as follows:

<?php
// $Id$
/** 
* function webform_edit_vocabulary
* Create a set of form items to be displayed on the form for editing this component.
* Use care naming the form items, as this correlates directly to the database schema.
* The component "Name" and "Description" fields are added to every component type and
* are not necessary to specify here (although they may be overridden if desired).
* @returns An array of form items to be displayed on the edit component page
**/
function _webform_edit_vocabulary($currfield) {
 $edit_fields = array();
 
 $result = db_query(db_rewrite_sql("SELECT vid, name FROM {vocabulary}"));
 while ($v = db_fetch_object($result)) {
   $vocabularies[$v->vid] = $v->name;
 }
 $edit_fields['extra']['vocabulary'] = array(
   '#type' => 'select',
   '#title' => t("Vocabulary"),
   '#options' => $vocabularies,
   '#default_value' => $currfield['extra']['vocabulary'],
   '#description' => t('The terms of this vocabulary can be selected by the user'),
   '#weight' => -2,
   '#required' => TRUE,
 );
 $edit_fields['extra']['multiple'] = array(
   '#type' => 'checkbox',
   '#title' => t("Multiple"),
   '#return_value' => 'Y',
   '#default_value' => ($currfield['extra']['multiple']=='Y'?TRUE:FALSE),
   '#description' => t('Check this option if the user should be allowed to choose multiple values.'),
 );
 $edit_fields['extra']['aslist'] = array(
   '#type' => 'checkbox',
   '#title' => t("Listbox"),
   '#return_value' => 'Y',
   '#default_value' => ($currfield['extra']['aslist']=='Y'?TRUE:FALSE),
   '#description' => t('Check this option if you want the select component to be of listbox type instead of radiobuttons or checkboxes.'),
 );
 return $edit_fields;
}

/** 
* function webform_render_vocabulary
* Build a form item array containing all the properties of this component
* @param $component An array of information describing the component, directly correlating to the webform_component database schema
* @returns An array of a form item to be displayed on the client-side webform
**/
function _webform_render_vocabulary($component) {
 $form_item = array(
   '#title'         => htmlspecialchars($component['name'], ENT_QUOTES),
   '#required'      => $component['mandatory'],
   '#weight'        => $component['weight'],
   '#description'   => _webform_filtervalues($component['extra']['description']),
   '#prefix'        => '<div class="webform-component-'. $component['type'] .'" id="webform-component-'. $component['form_key'] .'">',
   '#suffix'        => '</div>',
 );
 
 if ($component['extra']['aslist'] == 'Y' && $component['extra']['multiple'] != 'Y') {
   $options = array('' => t('select...'));
 }
 else {
   $options = array();
 }

 // Extract terms from user-selected vocabulary
 $tree = taxonomy_get_tree($component['extra']['vocabulary']);
 if ($tree && count($tree) > 0) {
   foreach ($tree as $term) {
     $options[$term->name] = str_repeat('-', $term->depth). $term->name;
   }
 }
 $default_value = current($options);  // first element of the array is the default value
 
 // Set the component options
 $form_item['#options'] = $options;
 
 // Set the default value
 if ($default_value) {
   // Convert default value to a list if necessary
   if ($component['extra']['multiple'] == 'Y') {
     if (strpos($default_value, ',')) {
       $varray = explode(',', $default_value);
       foreach ($varray as $key => $v) {
         if (array_key_exists(_webform_safe_name($v), $options)) {
           $form_item['#default_value'][] = _webform_safe_name($v);
         }
         else {
           $form_item['#default_value'][] = $v;
         }
       }
     }
     else {
       if (array_key_exists(_webform_safe_name($default_value), $options)) {
         $form_item['#default_value'] = _webform_safe_name($default_value);
       }
       else {
         $form_item['#default_value'] = $default_value;
       }
     }
   }
   else {
     if (array_key_exists(_webform_safe_name($default_value), $options)) {
       $form_item['#default_value'] = _webform_safe_name($default_value);
     }
     else {
       $form_item['#default_value'] = $default_value;
     }
   }
 }
 
 if ($component['extra']['aslist'] == 'Y') {
   // Set display as a select list:
   $form_item['#type'] = 'select';
   if ($component['extra']['multiple'] == 'Y') {
     $form_item['#multiple'] = TRUE;
   }
 }
 else {
   if ($component['extra']['multiple'] == 'Y') {
     // Set display as a checkbox set
     $form_item['#type'] = 'checkboxes';
     
   }
   else {
     // Set display as a radio set
     $form_item['#type'] = 'radios';
   }
 }
 return $form_item;
}


/** 
* function _webform_submission_display_vocabulary
* Display the result of a textfield submission. The output of this function will be displayed under the "results" tab then "submissions"
* @param $data An array of information containing the submission result, directly correlating to the webform_submitted_data database schema
* @param $component An array of information describing the component, directly correlating to the webform_component database schema
* @returns Textual output formatted for human reading.
**/
function _webform_submission_display_vocabulary($data, $component) {
 $form_item = _webform_render_vocabulary($component);
 if ($component['extra']['multiple'] == 'Y') {
   // Set the value as an array
   foreach ((array)$data['value'] as $key => $value) {
     if (array_key_exists(_webform_safe_name($value), $form_item['#options'])) {
       $form_item['#default_value'][] = _webform_safe_name($value);
     }
     else {
       $form_item['#default_value'][] = $value;
     }
   }
 }
 else {
   // Set the value as a single string
   foreach ((array)$data['value'] as $value) {
     if ($value !== '0') {
       if (array_key_exists(_webform_safe_name($value), $form_item['#options'])) {
         $form_item['#default_value'] = _webform_safe_name($value);
       }
       else {
         $form_item['#default_value'] = $value;
       }
       break;
     }
   }
 }
 $form_item['#attributes'] = array("disabled" => "disabled");
 return $form_item;
}


/** 
* function webform_submit_vocabulary
* Translates the submitted 'safe' form values back into their un-edited original form
* @param $data The POST data associated with the component
* @param $component An array of information describing the component, directly correlating to the webform_component database schema
* @returns Nothing
**/
function _webform_submit_vocabulary(&$data, $component) {
 $value = _webform_filtervalues($component['value']);
 $tree = taxonomy_get_tree($component['extra']['vocabulary']);
 if ($tree && count($tree) > 0) {
   foreach ($tree as $term) {
     $options[$term->name] = str_repeat('-', $term->depth). $term->name;
   }
 }

 if (is_array($data)) {
   foreach ($data as $key => $value) {
     if ($value) {
       $data[$key] = $options[$key];
     }
   }
 }
 elseif (!empty($data)) {
   $data = $options[$data];
 }
}

/**
* theme_webform_mail_vocabulary
* Format the output of emailed data for this component
*
* @param mixed $data A string or array of the submitted data
* @param array $component An array of information describing the component, directly correlating to the webform_component database schema
* @returns string Textual output to be included in the email
*/
function theme_webform_mail_vocabulary($data, $component) {
 // Extract terms from user-selected vocabulary
 $tree = taxonomy_get_tree($component['extra']['vocabulary']);
 if ($tree && count($tree) > 0) {
   foreach ($tree as $term) {
     $options[$term->name] = str_repeat('-', $term->depth). $term->name;
   }
 }
 $options = array();
 
 // Generate the output
 if ($component['extra']['multiple']) {
   $output = $component['name'] .":\n";
   foreach ($data as $value) {
     if ($value) {
       if ($options[$value]) {
         $output .= "    • ". $options[$value] ."\n";
       }
       else {
         $output .= "    • ". $options[_webform_safe_name($value)] ."\n";
       }
     }
   }
 }
 else {
   $output = $component['name'] .": ". $data ."\n";
 }
 return $output;
}

/** 
* function _webform_help_vocabulary
* Module specific instance of hook_help
**/
function _webform_help_vocabulary($section) {
 switch ($section) {
   case 'admin/settings/webform#vocabulary_description':
     $output = t("Allows creation of checkboxes, radio buttons, or select menus with taxonomy terms.");
     break;
 }
 return $output;
}

/** 
* function _webform_analysis_view_vocabulary
* Calculate and returns statistics about results for this component from all submission to this webform. The output of this function will be displayed under the "results" tab then "analysis"
* @param $component An array of information describing the component, directly correlating to the webform_component database schema
* @returns An array of data rows, each containing a statistic for this component's submissions.
**/
function _webform_analysis_rows_vocabulary($component) {
 $component['extra'] = unserialize($component['extra']);
 // Extract terms from user-selected vocabulary
 $tree = taxonomy_get_tree($component['extra']['vocabulary']);
 if ($tree && count($tree) > 0) {
   foreach ($tree as $term) {
     $options[$term->name] = str_repeat('-', $term->depth). $term->name;
   }
 }
 $options = array();
 
 $query = 'SELECT data, count(data) as datacount '.
   ' FROM {webform_submitted_data} '.
   ' WHERE nid = %d '.
   ' AND cid = %d '.
   " AND data != '0' AND data != '' ".
   ' GROUP BY data ';
 $result = db_query($query, $component['nid'], $component['cid']);
 $rows = array();
 while ($data = db_fetch_array($result)) {
   if ($options[$data['data']]) {
     $display_option = $options[$data['data']];
   }
   else {
     $display_option = $data['data'];
   }
   $rows[] = array($display_option, $data['datacount']);
 }
 return $rows;
}

/** 
* function _webform_table_data_vocabulary
* Return the result of this component's submission for display in a table. The output of this function will be displayed under the "results" tab then "table"
* @param $data An array of information containing the submission result, directly correlating to the webform_submitted_data database schema
* @returns Textual output formatted for human reading.
**/
function _webform_table_data_vocabulary($data) {
 // Set the value as a single string
 if (is_array($data['value'])) {
   foreach ($data['value'] as $value) {
     if ($value !== '0') {
       $output .= check_plain($value) ."<br />";
     }
   }
 }
 else {
   $output = check_plain(empty($data['value']['0']) ? "" : $data['value']['0']);
 }
 return $output;
}


/** 
* function _webform_csv_headers_vocabulary
*  Return the header information for this component to be displayed in a comma seperated value file. The output of this function will be displayed under the "results" tab then "download"
* @param $component An array of information describing the component, directly correlating to the webform_component database schema
* @returns An array of data to be displayed in the first three rows of a CSV file, not including either prefixed or trailing commas
**/
function _webform_csv_headers_vocabulary($component) {
 $header = array();
 $header[0] = '';
 
 if ($component['extra']['multiple']) {
   $header[1] = $component['name'];
   $tree = taxonomy_get_tree($component['extra']['vocabulary']);
   if ($tree && count($tree) > 0) {
     foreach ($tree as $term) {
       $items[] = $term->name;
     }
   }
   foreach ($items as $item) {
     $header[2] .= "\,". $item;
   }
   // Remove the preceding extra comma
   $header[2] = substr($header[2], 2);
 }
 else {
   $header[2] = $component['name'];
 }
 return $header;
}

/** 
* function _webform_csv_data_vocabulary
* Return the result of a textfield submission. The output of this function will be displayed under the "results" tab then "submissions"
* @param $data An array of information containing the submission result, directly correlating to the webform_submitted_data database schema
* @returns Textual output formatted for CSV, not including either prefixed or trailing commas
**/
function _webform_csv_data_vocabulary($data, $component) {
 $value = _webform_filtervalues($component['value']);
 $options = array();
 // Extract terms from user-selected vocabulary
 $tree = taxonomy_get_tree($component['extra']['vocabulary']);
 if ($tree && count($tree) > 0) {
   foreach ($tree as $term) {
     $options[$term->name] = $term->name;
   }
 }
 
 if ($component['extra']['multiple']) {
   foreach ($options as $key => $item) {
     if (in_array($key, (array)$data['value']) === true) {
       $output .= '\,Yes';
     }
     else {
       $output .= '\,No';
     }
   }
   // Remove the preceding extra comma
  $output = substr($output, 2);
 }
 else {
   $output = $data['value'][0];
 }
 return $output;
}

I think the problem is on this part of the code:

/**
* theme_webform_mail_vocabulary
* Format the output of emailed data for this component
*
* @param mixed $data A string or array of the submitted data
* @param array $component An array of information describing the component, directly correlating to the webform_component database schema
* @returns string Textual output to be included in the email
*/
function theme_webform_mail_vocabulary($data, $component) {
 // Extract terms from user-selected vocabulary
 $tree = taxonomy_get_tree($component['extra']['vocabulary']);
 if ($tree && count($tree) > 0) {
   foreach ($tree as $term) {
     $options[$term->name] = str_repeat('-', $term->depth). $term->name;
   }
 }
 $options = array();
 
 // Generate the output
 if ($component['extra']['multiple']) {
   $output = $component['name'] .":\n";
   foreach ($data as $value) {
     if ($value) {
       if ($options[$value]) {
         $output .= "    • ". $options[$value] ."\n";
       }
       else {
         $output .= "    • ". $options[_webform_safe_name($value)] ."\n";
       }
     }
   }
 }
 else {
   $output = $component['name'] .": ". $data ."\n";
 }
 return $output;
}

The newest select.inc (the file where Erik made the vocabulary.inc from) has one difference to the old select.inc and that is:
Old select

   $output = $component['name'] .": ". $data ."\n";

New Select:

    $output = $component['name'] .": ". $options[$data] ."\n";

Has this something to do with it?

Could somebody please help me to get this vocabulary support of webform working?

Thanks in advance!
greetings,
Martijn

summit’s picture

Status: Needs review » Needs work

Hi,

I have seen that the single term option works fine, but the selection of multiple terms not.
May be the code:

if ($component['extra']['multiple']) {
   $output = $component['name'] .":\n";
   foreach ($data as $value) {
     if ($value) {
       if ($options[$value]) {
         $output .= "    • ". $options[$value] ."\n";
       }
       else {
         $output .= "    • ". $options[_webform_safe_name($value)] ."\n";
       }
     }

Is not correct?
Can somebody please help?
Thanks in advance!
greetings,
Martijn

summit’s picture

Status: Needs work » Needs review

Hi,

Please can someone assist why the multiselect terms is not working?
The single select is working. The multiselect is working in the webform, but the email which is received has empty fields for selected terms..
Please assist!

Thanks a lot in advance!

greetings,
Martijn

summit’s picture

Status: Needs review » Active

Hi,

THis error is away using: http://drupal.org/node/154870#comment-574381
Deleting [] from
$form_item['#default_value'][] becomes $form_item['#default_value']

I still don't have my vocabulary output on mail..If somebody has a suggestion. Please assist!

greetings,
Martijn

summit’s picture

Title: Add A Taxonomy Term List To A Webform Select Component » Vocabulary.inc to get taxonomy terms in webform
StatusFileSize
new13.44 KB

Hi,

I think the bug should be in:

function _webform_submission_display_vocabulary($data, $component, $enabled = false) {
  $form_item = _webform_render_vocabulary($component);
  if ($component['extra']['multiple'] == 'Y') {
    // Set the value as an array
    foreach ((array)$data['value'] as $key => $value) {
      if (array_key_exists(_webform_safe_name($value), $form_item['#options'])) {
        $form_item['#default_value'] = _webform_safe_name($value);
      }
      else {
        $form_item['#default_value'] = $value;
      }
    }
  }
  else {
    // Set the value as a single string
    foreach ((array)$data['value'] as $value) {
      if ($value !== '0') {
        if (array_key_exists(_webform_safe_name($value), $form_item['#options'])) {
          $form_item['#default_value'] = _webform_safe_name($value);
        }
        else {
          $form_item['#default_value'] = $value;
        }
        break;
      }
    }
  }
  $form_item['#disabled'] = !$enabled;
  return $form_item;
}

Especially in:

 if (array_key_exists(_webform_safe_name($value), $form_item['#options'])) {
          $form_item['#default_value'] = _webform_safe_name($value);

This gives blank results back...
How can I debug this? Does somebody else also have this bug?
I attach my to webform 1.8 converted vocabulary.inc, please assist in solving this!Than webform has the taxonomy terms to be chosen from for your users!

Thanks in advance,
greetings,
Martijn

summit’s picture

Version: 5.x-1.7 » 5.x-1.8

Hi, the attachment: http://drupal.org/files/issues/vocabulary.txt is converted to webform 1.8.
Again, please assist.
Thanks in advance!
greetings,
Martijn

summit’s picture

Something went wrong, pressed twice..sorry..to late in the morning here..greetings, Martijn

quicksketch’s picture

Marked http://drupal.org/node/220733 as duplicate.

I'm not wild about this idea mostly because the code is 90% the same as select.inc, meaning every bug in select.inc will need to be fixed in vocabulary.inc also. Wouldn't it be possible to include as part of select.inc somehow instead?

quicksketch’s picture

Version: 5.x-1.8 » 5.x-2.x-dev
Category: bug » feature

New features are no longer being added to the 1.x branch which is now maintenance-only.

quicksketch’s picture

Marked http://drupal.org/node/230205 as duplicate.

summit’s picture

Hi,
I am testing webform 2.0 now, and it is great...But it still doesn't have taxonomy support for user-entries.
If it will not be in a seperate file as you described earlier, may be you could build it inside the select.inc please?
Thanks in advance for considering this. It would be a great add-on to webform I think!

greetings,
Martijn

summit’s picture

Title: Vocabulary.inc to get taxonomy terms in webform » Hierarchical select taxonomy in webform

Hi,
There is a great new module release in the making of hierarchical select (version 3). www.drupal.org/project/hierarchical_select
The taxonomy terms can be put in dropdown lists with depth option.
Could this be implemented in webform also, so finally a user can also select taxonomy terms with other values to fill a webform?

Thanks in advance for considering this!

greetings,
Martijn

quicksketch’s picture

Title: Hierarchical select taxonomy in webform » Vocabulary.inc to get taxonomy terms in webform

Please make a new request Summit. That one is quite different from the basic need of getting taxonomy terms into a select list.

wim leers’s picture

quicksketch: it's not :) It's a simple matter of changing #type and passing the preferred settings. You won't have to set #options anymore, either. But it definitely should be the second step, because it requires an additional dependency (on the hs_taxonomy module, which is included in HS).

wim leers’s picture

Here's the separate issue for HS support: http://drupal.org/node/278236#comment-906938.

summit’s picture

Quicksketch, do you still think it is a seperate issue? If so off course I make another one then.

It would be great to join both great modules together.

greetings,
Martijn

quicksketch’s picture

Great, we can use the issue Wim posted in #21 as the separate issue. Yes, it's still separate though, as the first goal (the purpose of this thread) is to get a dynamic select working. Integration with hierarchical select can come later.

summit’s picture

Hi Quicksketch,
great if dynamic select could become working. Then perfect it integration with HS would be possible!
Thanks!
greetings,
Martijn

hillaryneaf’s picture

subscribing

quicksketch’s picture

Just to let users know, I have absolutely no problem with a patch that enhances the existing select.inc. Also, I have no interest in personally implementing the feature. It's going to have to come from the community.

rgraves’s picture

I've added the patch from post #2 and after I added all my fields and customized all the administrative stuff for the form, I hit submit to save it. Now when I go to view my form, I get the following error:

Fatal error: Call to undefined function _webform_filtervalues() in /usr/local/lib/drupal/modules/webform/components/vocabulary.inc on line 55

I scanned through this page and didn't see a reference to this error. I don't see the actual function defined anywhere in the vocabulary.inc file.

Any suggestions?

quicksketch’s picture

I think this function has simply been renamed to _webform_filter_values()

rgraves’s picture

Thanks quicksketch, that solved the problem.

Like Summit, when I have multiselect enabled for the vocabulary list, the e-mail I'm receiving does not include the terms that were selected. Was this problem resolved? If it matters, I'm running version 2 of webform with Drupal 5.

Rob

quicksketch’s picture

I don't support the vocabulary.inc provided in this issue. As I've said before in #14 and #26, I'd prefer that someone provide a patch to select.inc that simply populates a select list with a given vocabulary. I'd be willing to add this functionality to Webform directly, but most people seem content to work with whatever they find instead of actually contributing back to the project itself.

summit’s picture

Hi Nathan,

I can't program it myself, but this functionality would be absolutely awesome to have with webform! Than vocabulary, and preferrebly also a list starting from a certain term or termlevel can be implemented in a webform.
The hierarchical select module has this functionality for node-support, taxonomy and content taxonomy, may be a webform widget from hierarchical select possible?

greetings,
Martijn

rgraves’s picture

This is a total hack, but I found out how to display multiple terms in the e-mail sent by webform when the list is a multiselect list.

In the function theme_webform_mail_vocabulary(), I changed:

$output .= "    â\200¢ ". $options[_webform_safe_name($value)] ."\n";

to

$output .= $value ."\n";

I'm not a drupal programmer, so I'm sure there's a better way to solve this, but it worked for what I need.

summit’s picture

Hi Robert,

Could you post your working vocabulary.inc here please?
Is it on webform 2.0?
Thanks a lot in advance!

greetings,
Martijn

@quickscetch. I hear you. I cannot program this, but are willing to test is.
I saw that HS is postponed, because it depends on the dynamic list stuff. Hopefully someone steps in to program this.
For now a working vocabulary.inc on webform 2.0 would be ok for shortterm solution, right?

greetings,
Martijn

rgraves’s picture

StatusFileSize
new13.24 KB

Here it is. It's for webform 2.0

summit’s picture

Hi Robert,

It is working, thanks!
You know what would be great, if Hierarchical Select would work with webform..

greetings,
Martijn

borapur’s picture

Version: 5.x-2.x-dev » 5.x-2.4
Assigned: Unassigned » borapur
Category: feature » bug

I am getting those warnings. It didnt desricbe the first table like xxx n
Thats why I am getting that warning and it prevents to use taxonomy in webforms.

user warning: Unknown column 'n.nid' in 'on clause' query: SELECT vid, name FROM vocabulary LEFT JOIN i18n_node i18n ON n.nid = i18n.nid WHERE (i18n.language ='en' OR i18n.language ='' OR i18n.language IS NULL) in /var/www/.../.../.../includes/database.mysqli.inc on line 154.
warning: Invalid argument supplied for foreach() in /var/www/.../.../.../includes/form.inc on line 950.

Is there another patch ? Or anything ?

borapur’s picture

OK We handled it.
Our alternations

-$result = db_query(db_rewrite_sql("SELECT vid, name FROM {vocabulary}"));
+$result = db_query("SELECT vid, name FROM {vocabulary}");
- _webform_filtervalues
+ _webform_filter_values

quicksketch’s picture

Assigned: borapur » Unassigned
Category: bug » feature
mnp’s picture

thanks for patch
but after adding that patch i added one component vacbulary then it is going blank destination page with url
mysme/?q=content/add-field-officer
same edit page but it is not going to component options page
why it is like that please tell me
it is very urgent for me
thanks in advance

lance.gliser’s picture

StatusFileSize
new13.05 KB

Good afternoon everyone.
I've updated this widget on the behalf of emfluence LLC in Kansas City.
Please test it, and enjoy.

Bugs Fixes:

Form

Checkbox format: warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\zupreem.com\includes\form.inc on line 1197
The problem was a default being set that was not accepted. I have commented the default on line 74 in case it is later needed.

Emails

Multiple select not being sent to in emails.
The problem was that while there was a theme hook to allow the output of custom vocabulary into the email, it was never registered.

Results

Multiple Values not retrieved in results view.
This may, or may not have been a problem to some. The visible value of fields was being stored in the database, not the posted value. So for taxonomy terms that were children --term was being stored. Which made it impossible to assign --term back as a match to the actual value of term. The database now stores the actual value of fields. *I have left the offending function: _webform_submit_vocabulary in the file, commented for historical purposes. Do not uncomment.*

Analysis

The analysis of values was failing. No information could be pulled.
This was another product of the incorrect storage method. It was fixed by storing the real value.

Features Added

Storage Method

All taxonomy related storage is now in the database using the taxonomy ID. When output is requested, the ID's name is translated. This should make updates to your taxonomy terms not break your forms.

Plans

We need a way to control the depth, and starting parent of the taxonomy for our own purposes. I'll be getting it done tomorrow if I'm not called off.

quicksketch’s picture

Version: 5.x-2.4 » 6.x-2.4
Status: Active » Needs review

Everyone should also take a look at #406486: Allow pluggable select list values, which presents some very interesting possibilities for populating select lists with values (such as vocabularies).

lance.gliser’s picture

Ok. I've been banging my head against this for a while now.
I've got it pulling in the list of terms under each vocabulary dynamically using AHAH.

Update: I'm still working on it. I found a couple of errors. The dynamic options work perfectly. Continuing on.

lance.gliser’s picture

StatusFileSize
new17.66 KB
new93.74 KB
new24.87 KB
Features Added

Hierarchy Limits

This release allows you to select terms to display, and a depth from them on the administration side. All reporting features still display the full, unfiltered list.

Issues

In order for this code to work, the webform module must be altered. I have posted the above for quicksketch to look over. If he chooses to include it or not, is not up to me. While I think future developers would welcome the AHAH hooks, he has a tighter view of security than I. Until we hash out differences, and he helps optimize the code I've brute forced for his methods, you may add the alterations listed yourself, or use the two extra files attached to this comment. Please note that either method you choose to add this functionality will require you to rebuild the system's menus to recognize the webform AHAH path ("hooks"). You can do this by clearing the cache or with Devel.

It's late, and I'm getting off work. If there's bugs, leave them posted. I'll look tomorrow.
It's tomorrow, and I've found bugs. But at the developer's request, I will not be posting fixes.

quicksketch’s picture

I'd just like to chime in and strongly discourage users from using modified versions of Webform. >:-(

lance.gliser, it'd be very much appreciated if you stopped work on the vocabulary.inc component. As I've mentioned (several times now #14, #26, and #30), this is not the way I would like this to proceed. Any users of vocabulary.inc will not receive any support from the Webform queue for any problems caused by it in the future.

Crell has proposed an alternative that I'd encourage developers to work with #406486: Allow pluggable select list values, where the select.inc component would be expanded to allow predefined lists, which could include Taxonomies, custom evaluated PHP, or any other predefined list (countries, states, etc.) This approach would allow for the same functionality as this vocabulary.inc file, only provide it with though an API and reduce the amount of duplicated code within Webform.

lance.gliser’s picture

lance.gliser, it'd be very much appreciated if you stopped work on the vocabulary.inc component

As you wish. I had not expected people to make a modified branch of your webform, I realize the problem with that. I was hoping we could work it together, but if this is completely off your vision, there's nothing to be done about it. Any word on importing CCK fields instead? Also:

This approach would allow for the same functionality as this vocabulary.inc file, only provide it with though an API and reduce the amount of duplicated code within Webform.

I hope that you will at least look at the things I've written. Most of it could be ported to the solution you are suggesting.

Development Stopped

At the request of the module maintainer, this direction is abandoned.

lance.gliser’s picture

Status: Needs review » Closed (won't fix)
summit’s picture

Hi Lance,

Couldn't you work with quicksketch on altering your solution to the right scope?
It would be a shame if your effort would vanish, so please consider going forward on: http://drupal.org/node/406486 ?

hopefully you consider this!

Thanks for your effort, I am still in the need of a good taxonomy-solution with webform and it would be great if you two came up with a great one!
Greetings,
Martijn
www.trekking-world.com

lance.gliser’s picture

I have no problem at all doing that. It was my goal from the start to work with him, not create branches.

I knew that I was duplicating a lot select.inc's code from the start. However, the pieces that required custom work that have been tagged through the files are what's important. In theory, select.inc could just include a hook to load select-vocabulary.inc, and other sub select functionality. The options and renderings created by the sub selects could be output through select.inc. I have already written AHAH hooks, quicksketch could use if he wanted to enable loading in the select lists on the fly. Consider this a proof of concept, if you want. It shows what needs done for sub select functionality, somewhat. But, design changes like AHAH functionality, and sub components are global design issues. That's something quicksketch would need to decide, and layout for the rest of us to work off.

I might work on this in my spare time, but for the purposes of our current implementation, this is where we need it. My logged work hours can not be spent here.

unfeasible’s picture

Subscribe.

lance.gliser’s picture

There is no point to subscribing to this thread as far as I know. The author fervently stated that this should go no further.
He has since put out updates for this nice module, and they are likely incompatible with the hacks developed here.
I suggest if you are interested in this kind of functionality, you go down roads he does approve of, or write your own modules to get this behavior.