Closed (fixed)
Project:
Webform
Version:
5.x-1.2
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2007 at 10:04 UTC
Updated:
22 Jan 2008 at 03:58 UTC
Great module! Can't quite figure out if what I want to do is possible:
Is this possible with webform module? If not, might it be possible using the form api directly? A previous support request indicated that the type of thing I'm looking for was impossible, but I believe that discussion occurred before the advent of form api version 2.
Thanks for your help!
Comments
Comment #1
isaac77 commentedSo it looks like I just need to include something like the following in "Additional Processing" ("Advanced" section):
Could someone confirm if this is the best way to accomplish the task? Does this create any kind of security risk?
THANKS!
Also: is there any way to refer to specific elements in $form_values with a name rather than numbers? Right now I'm using something like
$form_values['submitted']['1125812490']Comment #2
Marc Bijl commentedActually I'm looking for something equal: anonymous users should be able to fill in a quite extensive donation page (the webform), to be directed to a Paypal donation page directly afterwards. If possible, some of the webform fields filled in by the user should be used as "default values" at the Paypal page.
Found how it can be done with CCK (http://drupal.org/node/131807), but in fact I prefer webform :)
So basically I'm kind of subscribing here...
Comment #3
quicksketchI found a solution to this today and thought I would share. You can simply set the confirmation option in the $node variable dynamically depending on your needs. In the "Additional PHP Processing' you can enter the following code:
All processing will still be done as normal. If needed, you can also access the entire submission in the $form_values variable. In webform 1.3 and later, keys can be given to webform fields to make this process easier than trying to hunt down the right random numeric keys in the $form_values variable.
Comment #4
apratt commentedQuick note...
To use the key rather than the numerical reference you must use 'submitted_tree' rather than 'submitted'
Comment #5
scafmac commentedActually, I'm not sure that will work as you expect. If you look at the code, the submission is not recorded in the database until after the additional processing is performed. That means if you redirect the page in the additional processing field, it will be redirected before it is recorded in the database.
An alternate solution I've implemented and am testing now is to create a webform submission hook. It will be called just before the natural redirection would occur, which is well after the email submission and databased logging. This is a more flexible, albeit more complicated, solution. It is more complicated only because you would need to create a mini module to house the function hook_webform_submission, but I believe it is needed for any real post processing of of the form submission - issue http://drupal.org/node/159761
Oh also for New Oceans, there is already a module that integrates with Paypal http://drupal.org/project/simple_paypal & modules that use it - not sure if you were aware.
Comment #6
scafmac commentedQuicksketch - I hadn't read your fix carefully enough before, as I thought you were redirecting with the additional processing stuff rather than altering the confirmation. My mistake - I'll give this a try and see if it works for my needs.
Offhand it doesn't seem like the best solution because it requires the content maintainers to create/cut & paste php code. Besides the security question, I don't like needing to teach site maintainers what php code to add to the additional processing section - it is tough enough just to teach them to use the webform interface never mind php. And the php could get pretty complicated when you start constructing complicated urls - seems like something that should be left to developers not content creators.
This post might help others - http://drupal.org/node/159761
Comment #7
scafmac commentedFWIW, the solution from #3 doesn't work so well if you use Tiny_mce on node/* pages or if you are constructing urls that have get variables including email addresses - the @ symbol seems to break it. Not sure what other chars would also break it.
Neither is insurmountable - but it's a hassle.
Comment #8
quicksketch