Line 333 of select.inc:

    $element['#process'] = array('select_or_other_process', 'webform_expand_select_or_other');

this cut out any process functions set by other modules' HOOK_elements(). For example, I have this:

function multicolumncheckboxesradios_elements() {
  return array(

   .....

    'select_or_other' => array(
      '#process' => array('multicolumncheckboxesradios_select_or_other_process'),
    ),
  );
}

My process function is not called any more because of line 333.

Should do something like this:

function webform_elements() {
  return array(

   .....

    'select_or_other' => array(
      '#process' => array('webform_expand_select_or_other'),
    ),
  );
}


function webform_expand_select_or_other($elemnt) {
  if ($element IS FROM A WEBFORM) {

      do-webform-stuff...

  }

  return $element;

}

Comments

quicksketch’s picture

Thanks, this is a really good suggestion. Of course this means that the process function will run for all select_or_other fields, but considering most users use select_or_other specifically with Webform, looks like an obvious trade-off of performance and compatibility.

dooug’s picture

This is also the case for line 377 in webform/components/select.inc:

<?php
$element['#process'] = array('form_process_radios', 'webform_expand_select_ids');
?>

I discovered the problem trying to get the PrivateChoice module to work with webforms. (see: Webform module usage comment #17, my patch might not be efficient by invoking hook_elements)

quicksketch’s picture

StatusFileSize
new2.14 KB

I've fixed this for Drupal 7 with the attached patch, since D7 actually provides a dedicated function for solving this exact problem. In response to @dooug in #2, this also help the case with normal radio buttons and checkboxes.

However this approach is not easily back-portable to D6, so the issue remains in that version.

The new 3.16 version of Webform however contains a new hook which may assist in helping contrib modules. We now have a hook_webform_component_render_alter(), which gives modules a chance to alter an individual element before it is displayed. That could be a good opportunity for a module like multicolumncheckboxesradios to work-around the problem in Drupal 6.

quicksketch’s picture

Status: Active » Closed (won't fix)

I don't plan on backporting this fix to D6, so I'm marking this issue won't fix. The issue no longer exists for D7, as mentioned in #3.