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
Comment | File | Size | Author |
---|---|---|---|
#1 | webform-fixed_conditional_counter-1403586-1.patch | 613 bytes | tedbow |
component_list_test.node_code.txt | 7.65 KB | tedbow |
Comments
Comment #1
tedbowPatch attached. This same issue is in 6.x
Comment #2
quicksketchThanks tedbow, I'll review this next time I'm going through the webform queue.
Comment #3
tedbowNo problem. Thanks again for your work.
Comment #4
quicksketchThanks tedbow, finally committed.