Hello,

i'm facing this issue with webform email handler where i want to send specific email when some specific condition is met
for this i am using select option and this is multi select type selection

Warning: preg_match() expects parameter 2 to be string, array given in Drupal\webform\WebformSubmissionConditionsValidator->checkCondition() (line 763 of /var/www/html/modules/webform/src/WebformSubmissionConditionsValidator.php)

build form with select element with unlimited selection & selection type choices now in email handler choose conditions and there use pattern filter for multiple filter

all process is completed without any errors or warnings but when i submit form this warning came up and email not send.

Thank you

Comments

rakesh.regar created an issue. See original summary.

jrockowitz’s picture

Please post a simple example webform which can be used to trigger this issue.

rakesh.regar’s picture

StatusFileSize
new5.43 KB

Hi @jrockowitz

please find attachment of webform yml export

jrockowitz’s picture

This issue is related to #1149078: States API doesn't work with multiple select fields. Still, there might be a work-around to get server side conditional logic working as expected.

jrockowitz’s picture

The attached webform replicates the issue using webform element #states.

jrockowitz’s picture

StatusFileSize
new664 bytes
jrockowitz’s picture

StatusFileSize
new5.19 KB

Please ignore the last patch.

jrockowitz’s picture

Status: Active » Needs review
StatusFileSize
new6.46 KB

The attached patch attempts to fix this issue by refactoring the code to better support multiple value elements.

jrockowitz’s picture

An issue with the Webform Group module is triggering the 4 broken tests. Otherwise, the patch can be manually reviewed.

Ruchi Joshi’s picture

Issue is reproducible. And post applying patch its get resolved. No warning appears on selecting multi-select type option. Screenshots attached. +1 for RTBC.

jrockowitz’s picture

StatusFileSize
new6.37 KB

Same patch with the unused $element parameter for \Drupal\webform\WebformSubmissionConditionsValidator::checkConditionTrigger removed.

  • jrockowitz authored 58e6ebf on 8.x-5.x
    Issue #3162192 by jrockowitz, rakesh.regar: preg_match() expects...

  • jrockowitz authored 58e6ebf on 6.x
    Issue #3162192 by jrockowitz, rakesh.regar: preg_match() expects...
jrockowitz’s picture

Status: Needs review » Fixed
Ruchi Joshi’s picture

StatusFileSize
new45.47 KB

@jrockowitz Tested patch- "3162192-11.patch" and its working fine. +1 for RTBC

Status: Fixed » Closed (fixed)

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