I upgraded to webform 2 on a multi-site setup and most things are working very well. Unfortunately it has broken many instances of webforms that were front-ends for other functions where it used the POST redirect functionality that was removed from version 2.0 (no reason given in changelog).
1) Is there another way of getting this functionality that I'm not aware of? (One of the good things of that was that it didn't write to the database wich is perfect if you're using webform as a quick way to build a form w/o using the form API.) I know I could theoretically use the sid passwd as in $_GET to get the value but this is a bit schleppy compared to just having the POST values.
2) One possibility would be to use tokens on the redirect URL eg. internal:node/123?user=[field_user]&order=[field_order] or something similar. This would actually work really well with eg. redirecting to views etc.
Thanx
Anton
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | webform_redir_post-6.x-1.0.tar_.gz | 1.09 KB | asciikewl |
| #6 | webform_redir_post.tar_.gz | 1.07 KB | asciikewl |
| #4 | webform_redir_post.tar_.gz | 1.1 KB | asciikewl |
| #3 | webform_redir_post.tar_.gz | 1.09 KB | asciikewl |
| #1 | webform_redirect.patch | 1.43 KB | asciikewl |
Comments
Comment #1
asciikewl commentedI've just made a quick patch to get the old behaviour back with as little changes as possible. I've added the option of giving the redirect url as redirect:/somepage which then sets the #action for the form to /somepage.
Not sure if this is a good thing and I need to restore functionality to a number of webforms that used to rely on POST redirect.
Comment #2
quicksketchI took out this feature because it was rarely used, but very often misunderstood. Also, building forms in a UI, just to send the results off to some other processing mechanism felt very strange. If you're writing the processing on your own, the form should be manual also. This sort of manual connection throws out all the security FormsAPI provides.
So basically, I took it out because 1) it's a hack. 2) and it was confusing. It's been in Webform for years though (since before I started maintaining 2 years ago). If I would have been maintaining earlier, this feature never would have been added. I've thought about it long. Answering support questions, frequent misunderstandings, and just the general dirtiness using 1/4 the Webform interface as a front-end and throwing out the other 3/4 of the product (data analysis, e-mails, storage, editing, etc). Webform should focus on what it is made for, submitting and viewing simple forms. If you want to add back in this feature, it'll need to be implemented as a custom module that modifies forms using hook_form_alter().
Comment #3
asciikewl commentedKewl. I've written the module. Do you think it is better to publish it as a separate module or include it as a separate module in webform?
I've attached it for you to have a look.
Comment #4
asciikewl commentedI've made this into a module. Do you think I should publish it as a separate module or should it be a sub-module to webform? I've attached it for you to have a look.
Comment #5
quicksketchI'd prefer to make it another module entirely (not included with Webform). I think the approach is somewhat dirty, so I don't want to encourage people to use Webform for that purpose.
Comment #6
asciikewl commentedUntil I get some time to upload it as a module propper (and since I'm getting queries on this) I've attached the module version of this.
To re-instate redirecting POST values I've made the syntax (to make it clear what you're doing)
redirpost:URL
Anton
Comment #7
kcolwell commentedWow AsciiKewl thanks a ton for posting this module. I didn't have a clue what was breaking all of my forms and this saved me.
thanks again,
Comment #8
andrewfn commented@quicksketch
Please correct me if I am missing something, but as far as I can see the only realistic way for a confirmation form to be customized with data from the webform (e.g. using the person's name) is by POST variables.
It is not possible to use the GET variable (?sid=1234) because of course this allows any user to see the results from any other user and so is a total privacy violation.
Comment #9
dayofthedave commentedHow do I validate input when using redirpost? Unless I am mistaken, redirpost appears to bypass the validation on fields marked Mandatory and anything I put in the Additional Validation box. If this is so, I can still do validation on my redirpost page, but then how do I reload the form with relevant messages when invalid input is encountered?
Comment #10
asciikewl commentedGood question :)
I'll have a look, but for now your better bet might be to use something like formbuilder (D6) http://drupal.org/project/form_builder to make a custom form.
Comment #11
marcusk commentedI got many forms and one uses a redirection URL and uses the $_POST array to retrieve values from the submitted form.
I do not understand why the functionality of accessing form values in a redirected URL was removed.
I use it to have user interaction: the user enters some data and submits the form.
The redirected URL has PHP code to do a database query and prints a result page.
How do I implement user interaction as described above without having access to $_POST in redirected URLs ?
Marcus
Comment #12
asciikewl commentedIf you're using D5, use the module in comment #4. If you're using D6, I've attached a D6 version to this comment.
Untar it in your modules directory. Enable it under modules on your site. Go to a webform and you should see instructions to use it under "Confirmation message or redirect URL: ". Basically you do redirpost:/some-url where whatever is happening on that URL will use the $_POST values.
For a form with 1 fields, test1 and test2, the $_POST values will look something like this:
Array ( [submitted] => Array ( [test1] => aaa [test2] => bbb ) [details] => Array ( [email_subject] => default [email_from_name] => default [email_from_address] => default ) [form_build_id] => form-2c3d3454b0f63fcb63cc1c58121dd71d [form_token] => 592ebd090b2b3588c2badb55bdc362ae [form_id] => webform_client_form_28 [op] => Submit )
Please note that this short circuits all the nice webform code that normally saves your results in the database. It basically turns webform into a form builder, which is not what it is supposed to be, so really only use this for keeping legacy applications alive that used to use the $_POST redirect function.
Anton
Comment #13
jaybee1001 commentedHi - would this be suitable for use sending an HTTP Post to a 3rd party system which would then interrogate the post variables. I seem to be having issues as they are packed into an array???
Thanks
Comment #14
asciikewl commentedFor 3rd party apps that need the POST values in a specific way, writing a custom form is probably better. Have a look at http://drupal.org/project/form_builder as a possibility to do that graphically.