How to show a form in Dialog Modal jquery?
There's 2 good options I know of currently: iframe (in colorbox for example) and CTools. Which option to use depends of the circumstances. I guess this information I found in the CTools modal.html file brings out the main difference:


  CTools provides a simple modal that can be used as a popup to place forms. It differs from the normal modal frameworks in that it does not do its work via an iframe. This is both an advantage and a disadvantage. The iframe simply renders normal pages in a sub-browser and they can do their thing. That makes it much easier to put arbitrary pages and forms in a modal. However, the iframe is not very good at actually communicating changes to the main page, so you cannot open the modal, have it do some work, and then modify the page.


I have no personal experienced with CTools on this subject so I can't add anything else to that, but I've implemented the iframe method in a couple of projects. In the most recent one I used the Colorbox plugin to show a few forms created with the Webform module in a popup.
I'll add some example code here in case there's some interest.

Link to the form:

&lt;a class="colorbox_form" href="'.url('node/5').'"&gt;'.t('Send message').'&lt;/a&gt;


Javascript code to open the linked address in a popup:

if ($('a.colorbox_form').length &gt; 0) {
  var link = $("a.colorbox_form").attr('href');
  link = link.concat('?colorbox=true');
  // colorbox=true is attached for later use (read below).
  $("a.colorbox_form").attr('href', link);
  $("a.colorbox_form").colorbox({iframe:true, width:500, height:450});
}


In the theme template file:

function mytheme_preprocess_page(&amp;$variables) {
  // Different template and additional stylsheet for colorbox content.
  if (isset($_GET['colorbox']) &amp;&amp; $_GET['colorbox'] == TRUE) {
    $variables['theme_hook_suggestions'] = array('page__iframe'); // page--iframe.tpl.php
    drupal_add_css(path_to_theme() .'/iframe.css');
    $variables['styles'] = drupal_get_css();
  }
}


I attached 'colorbox=true' to the links using javascript so that users with javascript turned off would see the form with the normal template. The iframe template only has messages, title and content printed.

This already works, but I ran into a issue with Webforms: 'colorbox=true' wasn't preserved when the form got submitted. My attempt to fix it:

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  if (isset($_GET['colorbox']) &amp;&amp; $_GET['colorbox'] == TRUE) {
    // The id-s of the forms that are possibly shown within a popup.
    $form_ids = array('webform_client_form_2', 'webform_client_form_4');
    if (in_array($form_id, $form_ids)) {
      $form['#submit'][] = 'mymodule_webform_submit';
    }
  }
}

function mymodule_webform_submit(&amp;$form, &amp;$form_state) {
  //drupal_set_message('&lt;pre&gt;'.var_export($form_state['redirect'], TRUE).'&lt;/pre&gt;');
  if (!isset($form_state['redirect'])) {
    $form_state['redirect'] = array($_GET['q'], array('query' =&gt; array('colorbox' =&gt; 'true')));
  }
  else {
    $form_state['redirect'][1]['query'] = array('colorbox' =&gt; 'true');
  }
}