Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
To reproduce:
- Enable ctools_ajax_sample.module
- Navigate to /ctools_ajax_sample
- Click on any of the wizard links that involve a modal - eg "Wizard (default modal)"
- Make an animal selection, and click "Continue"
- Now click "Back" (make any required radio selections first to avoid core bug http://drupal.org/node/811542)
- You will now be at the first pane of the form again, but there will be a "Back" button where there should be none.
- You can now click the back button over and over again, looping through the form infinitely.
This bug does not occur if you click on the "Wizard (no modal)" link.
I'm just in the process of trying to figure out ctools, so I'm not sure if this is a bug in ctools, or a bug in the example, but getting it fixed would very much help advance my understanding of the module :) .
Comment | File | Size | Author |
---|---|---|---|
#4 | ctools-back_button_problem-1344708-4.patch | 722 bytes | sumthief |
Comments
Comment #0.0
JordanMagnuson CreditAttribution: JordanMagnuson commentedMade some text bold.
Comment #1
yogeshchaugule8 CreditAttribution: yogeshchaugule8 commentedHi JordanMagnuson, did you found solution for this issue, I'm facing the same issue.
I'm using 7.x-1.3 version of ctools.
Comment #2
JordanMagnuson CreditAttribution: JordanMagnuson commentedNo, sorry, didn't ever solve this.
Comment #3
adriankremer CreditAttribution: adriankremer commentedi just found that the "$not_first" var in "includes/wizard.inc" seems to be unused and can be used as condition in creating the previous button.
greetings adrian
Comment #4
sumthief CreditAttribution: sumthief as a volunteer and at DrupalJedi commentedHello
Faced with the same problem on my current project.
There is one of variants to solve this problem in #3.
But I think we shouldn't modify ctools_wizard_wrapper function for this.
Condition to add 'Back' button is very simple:
Also we have some manipulations with $previous variable some lines above.
Looks like the root of the problem is that passed $form_state for showing next step is built from previous step.
So I think we should unset it before new step was shown.
Here is a patch which solves this problem.
Comment #5
sumthief CreditAttribution: sumthief as a volunteer and at DrupalJedi commentedThere is an older issue which describes exactly same problem.
Here is a link - https://www.drupal.org/node/1488930.
Comment #6
Rushikumar CreditAttribution: Rushikumar commented@sumthief
Can confirm the patch in #4 fixes the issue.
My versions--
Drupal v7.52
ctools - 7.x-1.9