I have a scenario in which I need to post process the data submitted by a webform. In this case I need to send an email out to different people based upon a unique number that is submitted via the webform.
The number is sent to the webform via GET request and the number relates to an external postgres database that matches it to an email address. I don't want to display the email address out on the web.
Ideally it would be great if I could insert a bit of post processing that would happen just BEFORE the webform took in the data and processed it (i.e webform works on processed data).
Or is this a scenario wherein the actions module would help?
Comments
Comment #1
quicksketchTry downloading the latest CVS HEAD webform. A new feature exists to preform additional processing and validation. No documentation yet, but read http://drupal.org/node/81761 for a use-case scenario (very much like you want to do I believe).
While possible to achieve the desired effect by writing a custom module that implements a hook_form_alter to add custom validation, the new version makes the whole process much easier.
Comment #2
jredding commentedI'll check it out and let you know how it goes but from reading the link that you sent it sounds awesome!
My vote is in for keeping this feature! Post processing Whoo Hoo!!!
(I'll update again when I've actually had time to play with it).
Comment #3
jredding@drupal.org commentedI downloaded the CVS version but I didn't see the advanced settings in the webform. Maybe I downloaded the wrong version or I'm missing them?
The advanced features should be on the webform itself, correct?
Comment #4
quicksketchYep they're there. The "Advanced Settings" fieldset is now collapsed by default, it's in there.
Comment #5
jredding@drupal.org commentednevermind, I forgot to run the update.php script in the modules area.
Awesome!! Thank-you, I'm starting to write my script now. I will update and let you know how it goes!
Comment #6
jredding@drupal.org commentedThank you, Thank You, Thank You
This worked PERFECTLY, so easy, simple and just what was needed.
You made my life incredibly easier; awesome! Please keep up the good work.
For other peoples sake.. this is what I did.
-Upgraded to CVS
-Ran the update.php on the modules page (must be logged in as the 1st user, not just an admin account)
-Expanded "Advanced Settings" on the webform
-Added my php code.
To figure out exactly how to write my code I used print_r($form_values) to figure out the form elements and how to pull them out.
I ended up doing something like
$from_email = $form_values['submitted'][164533];
$subject = $form_values['submitted'][164522];
$body = $form-values['submitted'][165411];
user_mail($to_email, $subject, $body, $from_email);
The to_email came from a separate database based upon a GET variable passed in. Of course there was a lot of other processing going on with the necessary things like check_plain, mysql_escape_string, etc. etc. but that should give you the jist of it.
Thanks again!
Comment #7
g011um commentedIt looks as if this functionality has been removed from the CVS version, is that correct?
Sounds like it might save me the trouble of writing my own (PHP) node to post process the form submission (to send additional email etc etc) and I was hoping to test it out. Will it make a return in a future version?
Comment #8
quicksketchThis functionality has been committed to both the 4.7 and (newly added) 5.0 branches.
Comment #9
jredding commentedSchweet.. Thanks for keeping it in, I use it frequently. Love it!
Comment #10
(not verified) commented