Hi, I am implementing ctools with modal forms, very similar to the example module.

Simplifying things, I create my form and render it:

$output = ctools_modal_form_wrapper($form_id, $form_state);
ctools_ajax_render($output);

Then I render that in the page:

ctools_modal_text_button(t('Change'), 'my/callback', t('Frequency'), 'ctools-modal-frequency');

This all works properly and renders my form in the modal. However, my form is a multi page form. It's rendering the pager properly, but when clicking on the pager links it bombs out to a white page with only the JS on it. The pager links look like this:

http://mysite.com/my/callback?page=1&js=1&ctools_ajax=1

How do I handle paged content in the modal? I checked throughout the forum and didn't see anything like this so here I am. Any help you can provide would be appreciated. Thanks!

Comments

rjbrown99’s picture

Also, I do have ajax enabled in the form state.

$form_state['ajax'] = TRUE; 
merlinofchaos’s picture

Status: Active » Fixed

In order to have links in a modal function, you'll need to bind them to the proper URL and add the 'ctools-use-ajax' class to them.

msumme’s picture

Hey, have you figured this out yet? i'm working on the same problem, and I can't seem to get it. I've added the class by overriding the theme function, but I can't seem to get the ctools in-place ajax link working. Would overriding all the theme functions be necessary? Then using ctools_ajax_text_button to render each kind of pager link?

msumme’s picture

This was really really complicated, but it's possible...

I would love to see an elegant solution

rjbrown99’s picture

Have not tried to fix it yet. I'm going to see about binding the ctools-use-ajax class to the pager links. I'm assuming that's all I need to do. Haven't thought about the best approach for that yet.

msumme’s picture

seems like you have to just theme the pager... in whatever way.

the other problem is that if it's in a multi-step modal form, the path for the links will be wrong, i.e. for the page you just came from, rather than the page you're landing on. So you will have to also make sure to have a way to override that.

It wasn't pretty, but it can be done... Although I could just be ignorant of something that would have made it all a breeze...

Status: Fixed » Closed (fixed)

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