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
Comment #1
Anonymous (not verified) commentedI 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.
Comment #2
Anonymous (not verified) commentedI 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:
It seems to have done the trick. I can now put my payment field on any page within my multipage form.
Comment #2.0
Anonymous (not verified) commentedformatting, example
Comment #3
quicksketchFor 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.
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.
Comment #4
arruk commentedI 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.
Comment #5
dmsmidtThis 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
Comment #6
dmsmidtNew 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.
Comment #7
dmsmidtThis one doens't depend on the naming of the buttons.