Show a ctools modal after form submit I have a form:

//...
$form['submit'] = array(
  '#type' =&gt; 'submit',
  '#value' =&gt; t('Sumbit'),
);


I need when this form is validated and submitted then show a ctools modal.

This is my hook_menu for the modal:

$items['thankyou/%ctools_js'] = array(
    'title' =&gt; 'Thank you',
    'page arguments' =&gt; array(1),
    'access callback' =&gt; TRUE,
    'page callback' =&gt; 'thankyou_callback',
    'type' =&gt; MENU_CALLBACK,
  );
ctools_include('ajax');
ctools_include('modal');

ctools_modal_add_js();


The callback function:

function thankyou_callback($js = NULL) {
  // Content that we place in the popup.
  $popup_content = t('Thank you!');

  if (!$js) {
    return $popup_content;
  }

  ctools_include('modal');
  ctools_include('ajax');

  $output = array();
  $output[] = ctools_modal_command_display(t('Greetings'), $popup_content);

  print ajax_render($output);
  drupal_exit();
}


My form submit:

function myform_submit($form, &amp;$form_state) {
  // ...
  // show my modal here
  modal.show();  // ???
}


Then, How I show a ctools modal after form submit?

Please, with not ajax callback.
You need call form to Popup by function ctools_modal_form_wrapper

Any error, message will show in popup, to check submit success you need use statement 

if (!empty($form_state['executed'])) {
    $output[] = ajax_command_replace('#modal-content', 'Thank you');
}


Or you can use ajax form to call ajax.

$form['markup'] = array(
    '#markup' =&gt; '&lt;div id="pop-up"&gt;&lt;/div&gt;'
  );
//You need markup for wrapper 
$form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Sumbit'),
    '#ajax' =&gt; array(
      'wrapper' =&gt; 'pop-up',
      'callback' =&gt; 'modal_form',
    ),
  );


And function submit form 

function modal_form($form, &amp;$form_state) {
  //Process data when form submit
  ctools_include('modal');
  ctools_modal_add_js();
  $commands = array();
  $commands[] = ctools_modal_command_display('Form Submit', 'Say Thank You');
  print ajax_render($commands);
  exit;
}