You are here

function tableform_example_form in Tableform 7

Callback for /tableform_example

1 string reference to 'tableform_example_form'
tableform_example_menu in tableform_example/tableform_example.module
Implementation of hook_menu();

File

tableform_example/tableform_example.module, line 28

Code

function tableform_example_form() {
  $form = array();
  $form['my_table'] = array(
    '#type' => 'tableform',
    '#header' => array(
      t('Column 1'),
      t('Column 2'),
      t('Column 3'),
      t('Column 4'),
      t('Column 5'),
    ),
    '#options' => array(
      array(
        t('Some text'),
        'my_text' => array(
          '#type' => 'textfield',
          '#title' => t('Textfield'),
          '#size' => 10,
          '#required' => TRUE,
          '#default_value' => t('Default text'),
        ),
        'my_text2' => array(
          '#type' => 'textfield',
          '#title' => t('Textfield 2'),
        ),
        'my_select' => array(
          '#type' => 'select',
          '#title' => t('Select'),
          '#options' => array(
            t('Apple'),
            t('Orange'),
            t('Banana'),
          ),
          '#default_value' => array(
            1,
          ),
        ),
        'my_checkboxes' => array(
          '#type' => 'checkboxes',
          '#title' => t('Checkboxes'),
          '#options' => array(
            t('Apple'),
            t('Orange'),
            t('Banana'),
          ),
          '#default_value' => array(
            2,
          ),
        ),
      ),
      array(
        t('Some text'),
        'my_text22' => array(
          '#type' => 'textfield',
          '#title' => t('Textfield 3'),
          '#required' => TRUE,
          '#default_value' => t('Default text'),
        ),
        t('More Text!'),
        'my_radios' => array(
          '#type' => 'radios',
          '#title' => t('Radios'),
          '#options' => array(
            t('Apple'),
            t('Orange'),
            t('Banana'),
          ),
          '#default_value' => array(
            2,
          ),
        ),
        'my_select2' => array(
          '#type' => 'select',
          '#title' => t('Select'),
          '#multiple' => TRUE,
          '#required' => TRUE,
          '#options' => array(
            t('Apple'),
            t('Orange'),
            t('Banana'),
          ),
        ),
      ),
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}