Hi all,
I have a webform with a field "price". I need to know that value to compare and send an email.

Before, I had no problem accessing the data as follows with php:
$data->data[1][0];

but now always is empty.

I've tried this also:
<?php print $data['components']['price']['value'][0]; ?>

and with token:
[data:price-value]

and same result.

Do not know what can be the problem, but I can not access the data to work with.

I need your help. Sorry for my english.

Thanks!!

CommentFileSizeAuthor
#5 webform_rules-2270111.patch634 bytesshenzhuxi

Comments

kevster111’s picture

I think I have the same issue, with different use case. I can access a couple variables. My use is for creating a new node on a webform submission. Once submitted a node of a different content type gets created. Works for the most part but can't map submission components to new nodes fields with the exception when I use create new entity on submission I can access the title component. Basically the new node is create but just the title and author gets added. (somewhat useful but the fields would be nice). Tried all kinds of conditions to get the variables to be usable on action but seem to only be useable at the event level.

https://drupal.org/node/2020149 This is an issue I think relates and the patches might work to solve your issue. Not sure if its updated in latest dev though waiting on an answer.

bysv’s picture

How can i get the variable with the sid value?

If I print $data array ( print_r($data); ) i get the "sid" number at first level.

Array 
( 
  [704] => stdClass Object 
    ( 
      [sid] => 704 
      [nid] => 49 
      [serial] => 447 
      [submitted] => 1406286368
      ...  
      [data] => Array 
      ( 
        [1] => Array 
        ( 
          [0] => 250
        )
        ...

For example if the next submission id will be '705', i do:

print $data[705]->data[1][0];

and the value is showed ok (250).

I try to get the 'sid' variable with php to use it.

How can i get the variable with the sid value?

Thanks and sorry form my English!

bysv’s picture

Hi again,

In README.txt of Webform Rules module say:

To get the submission id, use <?php print $data['sid']; ?>

but the problem is that always is empty.

I dont know what can be the problem.

Need your help, Thanks!

irowboat’s picture

Be advised, WFM (Webform Multiple) might break the tokens! For instance [data:sid] was empty no matter what I did, until WFM was disabled.

shenzhuxi’s picture

StatusFileSize
new634 bytes

In hook_tokens, $data['webform'] is not array but object now.
Here is the patch to make it work with webform 7.x-4.12.

Tokens should be like:
[data:WebFormField]
[data:WebFormField-value]
[data:WebFormField-value-raw]

My test rule for example

{ "rules_webform_test" : {
    "LABEL" : "Webform test",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "webform_rules" ],
    "ON" : { "webform_rules_submit" : [] },
    "DO" : [
      { "drupal_message" : { "message" : "[data:sid]\r\n[data:wff]\r\n[data:wff-value]\r\n[data:wff-value-raw]" } }
    ]
  }
}
tsmulugeta’s picture

The patch in #5 didn't work

shenzhuxi’s picture

@tsmulugeta Can you export your rule and post it?

pauldolphin’s picture

Patch #5 did not work for me either.
webform_rules: 7.x-1.6+4-dev
webform: 7.x-4.10+8-dev
rules: 7.x-2.9
Created a test rule exactly like the one found in #5 and still submission data is empty. I do not have webform multiple installed as recommended in #4. Even print $data['sid']; produces no data.

It appears this is similar to the issue found at the following url. The latest version of these patches did not help resolve my issue either. Can anyone help point me in the right direction?
https://www.drupal.org/node/2020149

matthewgann’s picture

Patch in #5 worked for me.