Drupal Form to Choose Embedded View I'm trying to create a form that will allow a user to select a View from a list and then display that View on the same page. For instance:

$options = array();
$options['view_one'] = 'view_one';
$options['view_two'] = 'view_two';
$options['view_three'] = 'view_three';

$form['chooseview']=array(
    '#title'=&gt;'Choose a View',
    '#description'=&gt;'Which View do you want to display?',
    '#type'=&gt;'select',
    '#name'=&gt;'chooseview',
    '#required'=&gt;TRUE,
    '#options' =&gt; $options,
    );

print views_embed_view($form_state['values']['chooseview'],'block_1');


My question is how do I accomplish this? Drupal is not printing the embedded View from form_submit. I don't need Ajax.
Method #1: (No subit button, requires JS, loads all views at once but shows conditionally)

&lt;?php 
function MYMODULE_my_custom_form($form, &amp;$form_state) {
  $options = array();
  $options['view_one'] = 'view_one';
  $options['view_two'] = 'view_two';
  $options['view_three'] = 'view_three';

  $form['chooseview']=array(
    '#title' =&gt; t('Choose a View'),
    '#description' =&gt; t('Which View do you want to display?'),
    '#type' =&gt; 'select',
    '#name' =&gt; 'chooseview',
    '#required' =&gt; TRUE,
    '#options' =&gt; $options,
  );
  foreach ($options as $view_name) {
    $form['display'][$view_name] = array(
      '#type' =&gt; 'markup', // Not necessary - just to be clear. 
      '#markup' =&gt; views_embed_view($view_name, 'block_1'),
      '#states' =&gt; array(
        'visible' =&gt; array(
          ':input[name="chooseview"]' =&gt; array('value' =&gt; $view_name),
        ),
      ),
    );
  }
  return $form;
?&gt;


(short, eh)

Method #2: (Submit button, JS-independent, loads only view when necessary)
Note we pass $form_state to the form builder function by reference. 

&lt;?php 
function MYMODULE_my_custom_form($form, &amp;$form_state) {
  $options = array();
  $options['view_one'] = 'view_one';
  $options['view_two'] = 'view_two';
  $options['view_three'] = 'view_three';

  $form['chooseview']=array(
    '#title' =&gt; t('Choose a View'),
    '#description' =&gt; t('Which View do you want to display?'),
    '#type' =&gt; 'select',
    '#name' =&gt; 'chooseview',
    '#required' =&gt; TRUE,
    '#options' =&gt; $options,
  );
  $form['show_me'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Show me, please!'),
  );
  if (!empty($form_state['values']['chooseview'])) {
    $form['display'][$view_name] = array(
      '#type' =&gt; 'markup', // Not necessary - just to be clear. 
      '#markup' =&gt; views_embed_view($form_state['values']['chooseview'], 'block_1'),
    );
  }
}

function MYMODULE_my_custom_form_submit($form, &amp;$form_state) {
  $form_state['rebuild'] = TRUE;
}
?&gt;