Automatically close webform after submission I have created a Webform with some terms &amp; condition. I have added this webform in node/upload page. When user access node/upload page webform comes as overlay on the page. When user selects all terms &amp; condition and submits it redirects to another page which as close link. When close link is clicked webform hides.

What I want is instead clicking on close link to hide the webform. When user submits the terms &amp; conditions the webform must be hidden. How can i achieve this. I have added screen shot of webforms. 




I have added this code to get the webform in node/upload page

 if (!isset($user-&gt;data['guided'])) {
  $form['#attached']['js'][] = drupal_get_path('module', 'my_module') . '/js/my_module_ajax.js';
}
ctools_include('modal');
ctools_modal_add_js();
if (!isset($user-&gt;data['guided'])) {
$form['guideline'] = array(
  '#markup' =&gt; '&lt;p&gt;' . t('Review and follow the guidelines outlined in the &lt;a href="@guideline-page" class="ctools-use-modal"&gt;Submission guidelines&lt;/a&gt; before uploading an item.', array('@guideline-page' =&gt; url('modal_forms/nojs/webform/' . 31))) . '&lt;/p&gt;',
  '#weight' =&gt; -0.01,
);
}
You need to use hook_form_alter() and on submit of the form you need to set action like this

$form["#submit"][] = "ajax_modal_form_submit";


and add function

function ajax_modal_form_submit($form,&amp;$form_state) {
    ctools_include('ajax');
    ctools_include('modal');    
    $form_state['ajax_commands'][] = ctools_modal_command_dismiss();
    $form_state['ajax_commands'][] = ctools_ajax_command_reload();
    drupal_set_message(t("You detail submitted successfully!"));
  }