You are here

Drupal - Forms

----------------------------------------------------
I             Drupal-Forms                         I
----------------------------------------------------
 
http://api.drupal.org/api/file/developer/topics/forms_api.html/6
http://api.drupal.org/api/file/developer/topics/forms_api_reference.html/6
http://api.drupal.org/node/144132
http://api.drupal.org/api/group/form_api/6
 
    - Funktionsaufruf:
        $form = drupal_get_form('<modulename>_compose_form', $arg);
 
    - Form CTOR:
        function <modulename>_compose_form($context, $arg)
        {
            $form['itemname'] = array(
                '#type' => 'value',             // textfield, fieldset,
                                                // textarea, checkbox
                '#value' => $arg,
                '#title' => t('Titel'),
                '#size' => 50,
                '#maxlength' => 255,
                '#description' => t('Beschreibung'),
                ...
                '#cols' => 50,
                '#rows' => 5,
                ...
            );
 
            return $form;
        }
 
    - Handling Form Results:
        <modulename>_compose_form_validate()
 
        <modulename>_compose_form_submit($form, &$form_state)
        {
            $form_values = $form_state['values'];
            $form_values['itemname']
            ...
            // Submit fertig -> Angabe der URL welche weiter aufgerufen wird
            $form_state['redirect'] = sprintf('users/%d', 1);
        }