I have created a multi-step form using Ctools wizard and its working fine.

In multi step form, there is only images, so user will select the image and click on "Continue" button for next step. In the final step, I am showing the result of merged images which are selected in all previous step.

Images are rendering as ajax link in each step and when user click on any image, an ajax callback be executed.

In each step form load and ajax callback, fid of the images be stored in $_SESSION variable.

But the problem is that $_SESSION are not updating on the ajax call.

Suppose, there are five images in step 1 in the Ctools multi step form. When step 1 load, I am storing fid of first image into $_SESSION variable and If user click on any images, I am updating the fid in $_SESSION variable.

But, if I check print_r($_SESSION) in next step, its not showing the updated fid. Its only showing fid of the first image in previous step.

If I check ajax callback in fire bug console, its showing correct value of fid and $_SESSION variable.

Please suggest me what I am doing wrong.

Thanks in advance.

  • I'm not so good with ctools, but why can't you use something like $form_state instead of cache? Or any other drupal-managed way? Just curious.
    – Mołot
    Nov 19, 2013 at 8:48
  • @Mołot, I was also thinking about $form_state as there are approx 7 step in the form, so I use ctools, as we can mange the each step form easily in ctools .But, If I will not find any solution, then I will move to $form_state. Nov 19, 2013 at 8:53

2 Answers 2


you cannot use form_state. every step will have it's own. cache the date with ctools_object_cache_set


Here is a nice example how to create customizable multistep form without ctools wizard.

  • 2
    Hello. This is not an answer, only a link to answer. It will become useless if the linked site goes down. Can you please edit it to include the excerpt, and paraphrase the part that answers OPs problems with passing values?
    – Mołot
    Nov 19, 2013 at 10:26
  • 1
    Except that Molot's comment. Thanks for sharing the link. But why $_SESSION are not storing the variable properly. Nov 19, 2013 at 10:28
  • @JayendraKainthola I am not good with ctools wizard too. Thats why I can't answer to your question. But my opinion is, you should forget about $_SESSION variable, and create a form with the help of that link and store values in $form_state['multistep_values'] and get them at any step.
    – xurshid29
    Nov 19, 2013 at 10:59
  • @xurshid29, thanks for your suggestion. I will consider this. Nov 19, 2013 at 11:02
  • @JayendraKainthola If you want to test how this will work you can see an anction (this is my current project wich I am developing): carroza.uz/carroza.registration/individuals.do. A little bit explanation: I have a custom entity. My form's values are being stored in $form_state['multistep_values'] array, in last step I am getting all information from steps from $form_state['multistep_values'] and creating the entity.
    – xurshid29
    Nov 19, 2013 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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