I'm thinking this is done through PHP Execution after an event using the Replacement patterns below. Anybody has a take on it or a sample code?
Replacement patterns for The submitted webform data
TOKEN LABEL DESCRIPTION
[data:sid] Submission Id The unique identifier of the submission.
[data:data] Submitted data The submitted webform data.
[data:data-raw] Raw submitted data The unfiltered submitted webform data.
[data:{component}-title] Component title The title of the selected component, e.g. "email-title".
[data:{component}-value] Component value The value of the selected component, e.g. "email-value".
[data:{component}-value-html] Component value as html The value of the selected component rendered as html, e.g. "email-value-html".
[data:{component}-value-raw] Raw component value The title of the selected component, e.g. "email-title".
[data:{component}-display] Component display Title and value of the selected component, e.g. "email-display".
[data:{component}-display-html] Component display as html Title and value of the selected component rendered as html, e.g. "email-display-html".
Comments
Comment #1
emptyvoid commentedMy recommendation using PHP in your action state of the rule.
http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_goto/7
** of course to figure out what the data is structured you'd need to first have the rule trigger a message that prints the $data object, like so:
Comment #2
stborchertPlease reopen if any question is unanswered or you need more help.
Comment #3
bisonbleu commentedIn #1, the last line of the first code block should read
drupal_goto('http://www.example.com/...No underscore between 'go' and 'to'.
Comment #4
bisonbleu commentedThis works great! I'm able to POST the values of a simple webform to a Moneris sandbox with the following.
In the above, I've hardcoded data for a simple test. It works! Can someone suggest code for looping through $data? I'm not a programmer and I don't know where to start.
Here is a sample of what I get when I print_r($data);
Comment #5
bisonbleu commentedI'm making progress. The following code works; it produces the same output as in #4. Feel free to comment and/or improve it. In fact, that would be appreciated.
Comment #6
j4 commentedBisonbleu,
I have been going crazy for the past 10 days trying to get a rule to work on creation of a node. The rule is a execute php action that needs to collect user profile details as well as field values from the node created and post this information to an external site. When i ran the code with static valiues, all was fine and the posted information was getting received by the external site. BUt try as i might i am not able to read the values of the address fields in my content type using php. Can you help me? Am really desperate..:(
Thanks
Jaya
Comment #7
bisonbleu commentedHey Jaya,
I know what it's like to go crazy... :)
I'm no expert. But here's what I've learned from watching Nodeone's series on Rules - HIGHLY RECOMMENDED! (see references below).
When a rule is triggered, not all required objects are available. For example, when a Story node is created by a user, his profile is not available. If he's got a signature in his profile you can't access it when the Story node is created.
So what do you do? This is where Rule Sets come in and save the day. By using a Rule set, you can load the objects you need (such as a user profile). Once that object is loaded, you then have access to all its data.
Have a look at the following screencasts. They are for Drupal 6. But I'm pretty sure they apply to Drupal 7.
- episode #6 Introduction to the Rule Set concept: http://vimeo.com/17754350
- episode #7 Conditions on loaded objects: http://vimeo.com/18005306
And there's a new series for Rules under Drupal 7 here: http://nodeone.se/sv/node/32
Hope this helps!
Comment #8
j4 commentedHi,
Thank you for replying! I got it done by using wrappers and entity metadata finally thanks to some great help from the drupal IRC. You are right, about not all the information being present. Am happy to have learnt something,
Thanks again
Jaya