The problem is that an sid is created after the first part of the form is submitted (perhaps this only happens when we have 'automatically save in draft mode' selected?).

In any case, perhaps checking arg() would be better? For now I just closed the conditional.

The problem is

// If editing a submission, do NOT reprocess payment information. This
  // information becomes display-only.
  if (!empty($form['#submission']->sid)) {
    $submit_index = array_search('pay_submit', $form['#submit']);
    $validate_index = array_search('pay_validate', $form['#validate']);
    if ($submit_index !== FALSE) {
      unset($form['#submit'][$submit_index]);
    } 
    if ($validate_index !== FALSE) {
      unset($form['#validate'][$validate_index]);
    }
  }

in webform_pay_after_build

Comments

Anonymous’s picture

I have a problem with multipage forms as well...

1. The payment field seems to work properly if it is placed on the first page for the form. I can submit credit card numbers and successfully move on to the next page of the form.
2. If I put the payment field on the second page of the form (or any subsequent pages), I run into problems when submitting said page. The site goes to a white screen. Looking at the PHP error logs, it seems as though the webform_pay module is trying to extend the pay_form class at the start of the webform_pay.inc file but not finding any classes by that name.

Any help would be greatly appreciated. I'm new to the Payment API and Webform Pay modules. So I'm having a difficulty doing much more troubleshooting. Thanks.

Anonymous’s picture

I should note that I fixed my problem by just including the pay.inc and pay_form.inc files from the 'includes' directory of the pay module. This is what I put at the top of my webform_pay.module:

<?php
module_load_include('inc', 'pay', 'includes/handlers/pay');
module_load_include('inc', 'pay', 'includes/handlers/pay_form');
?>

It seems to have done the trick. I can now put my payment field on any page within my multipage form.

Anonymous’s picture

Issue summary: View changes

formatting, example

quicksketch’s picture

Title: Multipage webforms fail to submit payment. » Multipage webforms fail to submit payment when drafts are enabled
Issue summary: View changes

The problem is that an sid is created after the first part of the form is submitted (perhaps this only happens when we have 'automatically save in draft mode' selected?)

For the original poster's question, I think you're right that Webform Pay just doesn't work with save as draft enabled. Let's make that the topic of this issue.

I should note that I fixed my problem by just including the pay.inc and pay_form.inc files from the 'includes' directory of the pay module.

For @mikegoodwin's question, this sounds like the class registry wasn't up-to-date. Drupal should auto-load classes as needed when they're used/extended. Sometimes after updating a module, the registry isn't accurate and it can lead to classes being not found. Usually you can fix this by enabling or disabling a module.

arruk’s picture

I can confirm that this is an issue when autosave is selected on a multi page form, with the payment field on any page but the first. Adding the include functions as suggested in #19 did not resolve this issue for me. Turning off the autosave allowed the form to process properly but then it did not run the macros that are needed to generate a total view.

dmsmidt’s picture

This patch fixes the issue for the D6 dev version using gdoteofs idea.
Probably works for D7 as well.

// Working on making the back button work again

dmsmidt’s picture

StatusFileSize
new622 bytes

New patch for D6-dev.
This prevents redirecting to paypal when pressing the back button (which is also a submit).
It's a tad ugly sollution I guess.

dmsmidt’s picture

StatusFileSize
new1.33 KB

This one doens't depend on the naming of the buttons.