example_form

Versions
6 – 7
example_form(&$form_state, $url)

Form API array definition for the example form.

Code

developer/example.profile, line 273

<?php
function example_form(&$form_state, $url) {

    // This is just a very simple form with one textfield, and a
    // submit button.
    $form['example_text'] = array(
      '#type' => 'textfield',
      '#title' => st('Testing text'),
      '#default_value' => '',
      '#size' => 45,
      '#maxlength' => 45,
      '#required' => TRUE,
      '#description' => st('This is an example form demonstrating forms usage in the installer profiles tasks. Enter any text to see what happens.'),
    );

    $form['continue'] = array(
      '#type' => 'submit',
      '#value' => st('Continue'),
    );

    // Note that #action is set to the url passed through from
    // installer, ensuring that it points to the same page, and
    // #redirect is FALSE to avoid broken installer workflow.
    $form['errors'] = array();
    $form['#action'] = $url;
    $form['#redirect'] = FALSE;

  return $form;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.