I found a problem that when you are using components that don't support "conditional" that components on the same page will show in the "Components" selectbox under Conditional Rules when editing a component.

The problem is in "includes/webform.components.inc". When looping through to find all components on previous pages that a component can be conditional on.

    if (webform_component_feature($test_component['type'], 'conditional')) {
      $conditional_components[$cid] = $test_component;
    }
    $counter++;

$counter should only be incremented when you actually add the $test_component to the array.
So this fixes it:

    if (webform_component_feature($test_component['type'], 'conditional')) {
      $conditional_components[$cid] = $test_component;
      $counter++;
    }

The problem only occurs when using multiple components where

webform_component_feature($test_component['type'], 'conditional') == FALSE

So it won't always show up.
I am attaching the a very simple 2 page webform (exported via Node Export) that has the problem b/c it uses 2 "markup" elements on the first page. Here is the basics of the form.

  • text1
  • markup1
  • markup2
  • page1
  • text2
  • text3

Click to edit the text3 and you will see "text2" in the component list under "Conditional Rules". It should be there.

I will attach the patch in the next comment

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tedbow’s picture

Status: Active » Needs review
FileSize
613 bytes

Patch attached. This same issue is in 6.x

quicksketch’s picture

Thanks tedbow, I'll review this next time I'm going through the webform queue.

tedbow’s picture

No problem. Thanks again for your work.

quicksketch’s picture

Status: Needs review » Fixed

Thanks tedbow, finally committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.