This module provides a kind of form container which allows to multiply its child elements to give a system of multiple values. The form element multiplier is presented as a table to which you can add, remove and order rows.
Usage
Create a multiplier element is as simple as create a container or a fieldset, just look at the following example :
$form = array();
$form['multiplier'] = array(
'#type' => 'multiplier',
'#title' => t("Multiplier example"),
'#default_value' => variable_get('multiplier', array()),
);
$form['multiplier']['text'] = array(
'#type' => 'textfield',
'#title' => t("Text"),
'#default_value' => "Lorem ipsum...",
'#required' => TRUE,
'#size' => 30,
);
$form['multiplier']['select'] = array(
'#type' => 'select',
'#title' => t("Select"),
'#options' => array(
0 => 'Option 1',
1 => 'Option 2',
2 => 'Option 3',
),
);
$form['multiplier']['container'] = array(
'#type' => 'container',
'#title' => t("Container"),
'#tree' => TRUE,
'child_1' => array(
'#type' => 'textfield',
'#title' => t("Child 1"),
'#size' => 20,
),
'child_2' => array(
'#type' => 'checkbox',
'#title' => t("Child 2"),
),
);
return system_settings_form($form);
Features