Hi,

I have tried setting up webform components to show in the rules condition option, I have already created event by webform submitted.

but it is not available for the webform elements/components,
can someone help?

thank you

CommentFileSizeAuthor
#3 1560308-3.jpg52.66 KBstborchert

Comments

stborchert’s picture

Status: Active » Closed (won't fix)

To use webform fields as condition values you have to use a PHP condition (unless someone writes a patch that allows selecting the fields directly).

boby_ui’s picture

can you give an example to the snippet code, I don't really understand the code.

thank you

stborchert’s picture

StatusFileSize
new52.66 KB

* install the module Devel
* add a condition "Execute custom PHP code" to you rule and insert

<?php 
dpm($data);
return TRUE;
?>

In my test I have a webform with two fields ("module_list": list of checkboxes; "other_modules": textfield) that results in this output while executing the rule:
rules condition debug output

Now I could use this code to check if "views" has been selected in my webform:

<?php 
return isset($data['components']['module_list']) ? in_array('views', $data['components']['module_list']['value']) : FALSE;
?>
boby_ui’s picture

thank you! let me test that :)