1

I'm trying to build a multi-step form with Ctools that will submit to another website upon completion (a hosted payment page). On the last form page, I have set the #action property in the form array to allow it to submit to this other website. My issue however is that this seems to affect the Back button behavior on this form page and directs me to the website I specified in #action when clicked, which is obviously not desired.

Are there additional settings I can tweak to make the Back button behave correctly with the #action property set?

0

A simple solution would be to add a drupal_goto call to redirect to the payment site in the submit handler for the completion step.

| improve this answer | |
0

I'm not able to use CURL or drupal_goto(), as I needed to submit to the hosted payment page with the POST data, and be on the actual page (something only achievable with a physical form submission).

I ended up attaching a javascript click behavior to the back button to get the desired effect. Probably not the best solution, but it created the desired behavior.

| improve this answer | |
0

You could drop the #action, then add some curl() code to your #submit callback function for the final step.

Trickier, sure, but it'll work without messing up the form caching for Drupal.

| improve this answer | |
  • Why use something like curl? – googletorp Jul 21 '11 at 15:58
  • Because curl would do what @bkildow asked for, i.e. sending the form data in post to the desired location, without messing with the drupal cache, and without relying on javascript effects which can be turned off at the browser level. drupal_goto won't do that. – Drupal Development Costa Rica Jul 22 '11 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.