Hi,

i got a webform with some conditions. In the frontend everything works fine, but in the results the field after the second condition is missing!

so if there are conditions like "if A is Apples then show B" and after that "if B is Green Apples then show C" and user is choosing Big Green Apples in C, field C with the Big Green Apples is missing in my results.

is that a known bug?

thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Hi @FNGR, thanks for the report. I haven't experienced this problem myself but I'll try to reproduce it when I get the chance. Webform should be able to handle this situation. Since all conditional checking hinges purely on the submitted values, it shouldn't matter if a 3rd field is dependent upon a 2nd field (which is dependent upon the 1st field). As long as the 2nd field has the right value, the 3rd field should be shown when viewing the results.

Drupal Musician’s picture

I am experiencing this issue as well. My issue is not limited to select list responses not being included, text fields are not included either. After looking into an issue with the Select (or other) module and webform labels I saw that the fields which are not in the results are those whose display is conditional on a select list with the "other" option enabled. To be clear. If the Field A is a select list with the other option enabled, the fields that are displayed conditional to A's answer do not store in the results. I decided to try disabling the Select (or other) module. This solved the issue with the labels and the conditionals of select lists not being shown in the results. It seems that there is an issue with of the Select (or other) module which interferes with the conditions of the select list it is applied to I have recreated the issue in 7.x 2.19 and 2.18. It throws this error as well when enabled. Warning: strcasecmp() expects parameter 1 to be string, array given in webform_conditional_operator_string_equal() (line 892 of /sites/all/modules/webform-7.x-4.0-alpha10/webform/includes/webform.conditionals.inc).

michaelschutz’s picture

Hi - I can confirm that this is happening with Select (or other) fields only. Values in fields are displayed as a result of conditions (both select and textfields) are not being submitted properly (though they're acting just fine on the form page - they show up properly and can be filled out/clicked on normally). I get the same error for each value that's trying to be passed:

"Warning: strcasecmp() expects parameter 1 to be string, array given in webform_conditional_operator_string_equal() (line 892 of /SITEDIR/sites/all/modules/webform/includes/webform.conditionals.inc)."

If it's a select that doesn't include "other", then it stores the value fine. I don't know enough to know if this is a fix needed in Webform or Select-or-Other.

Using 7.x-4.0-beta1.

TBarina’s picture

Subscribe #3

blueblot’s picture

hi
I had the same problem with conditionals and select-or-other. I just disabled the select-or-other module and created my select list with conditionals.

After I enabled the module select-or-other again, I added the "other" option and now it works fine.

also using 7.x-4.0-beta1

Blueblot

msnassar’s picture

Issue summary: View changes

i also faced this issue and still.
i have hierarchical multiple select with select_or_other component like:
field1 (radio btn)
----field11 (multiple select with select_or_other)
------field111 (multiple select with select_or_other)

Warning: strcasecmp() expects parameter 1 to be string, array given in webform_conditional_operator_string_equal() (line 892 of sites/all/modules/contrib/webform/includes/webform.conditionals.inc).

i am using 7.x-4.0-beta2

any fix?

msnassar’s picture

Hi again,
The issue still exists in beta3.

joelstein’s picture

Status: Active » Needs work
FileSize
685 bytes

Same issue here. The $input_values come in as a nested array of 'select' and 'other' arrays, instead of a single array of values.

The attached patch doesn't fix all conditional callbacks, but it does fix for the "is equal" callback, which is what I needed. Somebody else can run with this and fix the other use cases.

Liam Morland’s picture

Status: Needs work » Needs review

The fix in #2307619: Warning: strcasecmp() expects parameter 1 to be string, array given in webform_conditional_operator_string_equal() takes care of the "strcasecmp() expects parameter 1 to be string" warning. It does essentially the same thing as the patch in #8.

Setting to "needs review" due to the patch in #8.

DanChadwick’s picture

Re patch #8: I suspect that this patch would cause problems with a select list containing "select" as a key and no "other" list.

DanChadwick’s picture

Status: Needs review » Needs work

The last submitted patch, 8: webform-select-or-other-conditional-1901814-8.patch, failed testing.

DanChadwick’s picture

Fixed by virtue of related issue being fixed (in a different way than patch #8). Marking as duplicate.