I've got a use case where a form is opened in a modal overlay, after the overlay form is submitted I need to submit the "parent" form from where the overlay was called.

Example usage:

$commands = array();
$commands[] = ctools_ajax_command_submitform('#parent-form');
CommentFileSizeAuthor
#1 590654_ajax_submit_form.patch1.25 KBfenstrat

Comments

fenstrat’s picture

Status: Active » Needs review
StatusFileSize
new1.25 KB

This is based on #568578: Add ajax command for client side redirect

ps. Is there a way to extend the ajax commands without directly patching ctools itself? Writing commands like yourmodule_modal_command_submitform is easy enough, but extending command functions in Drupal.CTools.AJAX.commands must be done after ajax-responder.js is loaded otherwise any additions are clobbered. This is tricky given drupal_add_js inability to set order/weight in d6. Am I missing something simple here?

merlinofchaos’s picture

Status: Needs review » Fixed

AS long as you do ctools_add_js('ajax-responder') right before your own drupal_add_js you should be guaranteed that it will come before yours.

That said as part of this I went ahead and reconfigured the system so that it doesn't matter which comes first. Also, I renamed it from 'submitform' to just 'submit' since Drupal coding standard dislikes smashing two words together without a separator.

fenstrat’s picture

Fantastic, thank for that Earl.

Status: Fixed » Closed (fixed)

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