I have a webform with additional processing. I pass information to the additonal processing code in the URL. For example, if the webform is node 134, the URL to the form would be /node/134/myextrainfo. I then pick up this extra info using a hidden field set to %server[REQUEST_URI].
The issue comes when a user makes a mistake when filling out the form. The form action is then changed to the webform node only (/node/134) in my example, and myextrainfo is lost.
I have found that if I comment out the line that sets $form[#action] in webform.module, then the URL is not changed.
// Set the form action to the node ID in case this is being displayed on the
// teaser, subsequent pages should be on the node page directly.
if (arg(2) != 'submission') {
//$form['#action'] = url('node/'. $node->nid);
}
This works for the way I have webform setup, but that code is probably needed in other circumstances, as noted in the comment.
Is there another way to rework this if statement? Or will I simply need to comment it out every time I upgrade webform?
Comments
Comment #1
mkrakowiak commentedIs it actually possible to select an external URL for
$form['#action']?For example:
$form['#action'] = url('https://example.com/pay.php');If not, this would make a valuable addition to Webform. Or maybe there's another way of dealing with it?
Comment #2
quicksketchPlease see http://drupal.org/node/250767.
mkrakowiak, this actually was a feature of the 1.x version for years. However, it caused WAY to many headaches and IMO, was a complete hack that you'd use Webform to create a form, then submit it off to another URL. You might as well type out an HTML page if Webform isn't going to do any processing, e-mails, or analysis features.