I have been using the multistep form wizard for a project and it works great. However, I have noticed that there is a way to define a callback for all the buttons except for the back button. I would like to have a way to define a callback for the back button so that if a user fills in the page of the form that they are on, then decides to move backwards, the values that they just filled in will save. Right now the values are only stored when the users moves forward through the form. Thanks!

Comments

merlinofchaos’s picture

Status: Active » Fixed

There is one. You set it via 'back callback'.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

bspot’s picture

Version: 6.x-1.3 » 6.x-1.8
Category: feature » bug
Status: Closed (fixed) » Active

I don't know whether this worked in 6.x-1.3, but it doesn't work in 6.x-1.8:

In wizard.inc:248, the #wizard type attribute of the back button is set to next.

Hence, when using the back button, the next callback will be called instead of the back callback.

Is this on purpose or just a typo?

merlinofchaos’s picture

Status: Active » Fixed

Oh, heh. I'd forgotten I'd done it that way.

In that case, you can easily check $form_state['clicked_button'] to see which button was pressed, and act appropriately.

They both use the 'next' callback because in every use case I've ever had, they act the same, except that 'back' doesn't submit or validate.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.