Note that there are some explanatory texts on larger screens.

plurals
  1. PODrupal Form API - Display Form Values upon submission
    text
    copied!<p>I've read the Drupal API Form documentation but there's something I'm just not getting.<br /><br /> It's probably really simple but I can't find out how to display the submitted values of a form after it's submission.</p> <p>*edited code</p> <pre><code>&lt;?php function createForm_enigmaFilters($form_state) { $form = array(); $form['#submit'][] = 'createForm_enigmaFilters_submit'; $form['list'] = array( '#type' =&gt; 'markup', '#prefix' =&gt; '&lt;ul id="enigmaFilters"&gt;', '#suffix' =&gt; '&lt;/ul&gt;', ); $form['list']['startDate'] = array( '#id' =&gt; 'txtStartDate', '#weight' =&gt; '0', '#type' =&gt; 'textfield', '#size' =&gt; '20', '#title' =&gt; 'Date de début', '#prefix' =&gt; '&lt;li&gt;', '#suffix' =&gt; '&lt;/li&gt;', ); $form['list']['endDate'] = array( '#id' =&gt; 'txtEndDate', '#weight' =&gt; '1', '#type' =&gt; 'textfield', '#size' =&gt; '20', '#title' =&gt; 'Date de fin', '#prefix' =&gt; '&lt;li&gt;', '#suffix' =&gt; '&lt;/li&gt;', ); $form['list']['enigmaName'] = array( '#id' =&gt; 'txtEnigmaTitle', '#weight' =&gt; '2', '#type' =&gt; 'textfield', '#size' =&gt; '100', '#title' =&gt; 'Nom des énigmes', '#prefix' =&gt; '&lt;li&gt;', '#suffix' =&gt; '&lt;/li&gt;', ); $form['list']['lstAnswers'] = array( '#id' =&gt; 'lstAnswers', '#weight' =&gt; '3', '#default_value' =&gt; 'Uniquement les bonnes', '#key_type' =&gt; 'associative', '#type' =&gt; 'select', '#options' =&gt; array( 'Toutes les réponses' =&gt; 'Toutes les réponses', 'Uniquement les bonnes' =&gt; 'Uniquement les bonnes', ), '#multiple_toggle' =&gt; '1', '#title' =&gt; 'Réponses', '#prefix' =&gt; '&lt;li&gt;', '#suffix' =&gt; '&lt;/li&gt;', ); $form['list']['promotionYear'] = array( '#id' =&gt; 'txtPromotionYear', '#weight' =&gt; '4', '#type' =&gt; 'textfield', '#size' =&gt; '40', '#title' =&gt; 'Année de promotion', '#prefix' =&gt; '&lt;li&gt;', '#suffix' =&gt; '&lt;/li&gt;', ); $form['list']['submit'] = array( '#id' =&gt; 'lnkApplyFilters', '#weight' =&gt; '5', '#type' =&gt; 'submit', '#value' =&gt; t('Rechercher'), '#prefix' =&gt; '&lt;li&gt;', '#suffix' =&gt; '&lt;/li&gt;', ); return $form; } function createForm_enigmaFilters_submit($form, &amp;$form_state) { echo $form_state['values']['startDate']; echo $form_state['values']['endDate']; echo $form_state['values']['enigmaName']; echo $form_state['values']['lstAnswers']; echo $form_state['values']['promotionYear']; } echo drupal_get_form('createForm_enigmaFilters'); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload