function matrix_example in Matrix field 6.2
Form Definition
1 string reference to 'matrix_example'
- matrix_menu in ./
matrix.module - Implementation of hook_menu().
File
- ./
matrix.module, line 1247 - Defines simple matrix field types.
Code
function matrix_example() {
$form['matrixfield'] = array(
'#type' => 'matrix',
'#mode' => 'cols',
'#title' => 'Example matrix element',
'#description' => 'This is how you use it!',
'#ahah_enabled' => TRUE,
'#cols_elements' => array(
array(
'#type' => 'textfield',
'#title' => 'Textbox 1',
'#default_value' => 'One',
'#required' => TRUE,
),
array(
'#type' => 'title',
'#title' => 'Title 1',
),
array(
'#type' => 'select',
'#title' => 'Select 1',
'#options' => array(
'one' => 'One',
'two' => 'Two',
'three' => 'Three',
),
'#default_value' => 'two',
),
array(
'#type' => 'checkbox',
'#title' => 'Checkbox 1',
'#default_value' => TRUE,
),
array(
'#type' => 'radios',
'#title' => 'Radios 1',
'#options' => array(
'one' => 'One',
'two' => 'Two',
'three' => 'Three',
),
'#default_value' => 'two',
),
),
'#rows_elements' => array(
array(
'#title' => 'Row 1',
),
array(
'#title' => 'Row 2',
),
array(
'#title' => 'Row 3',
),
),
);
$form['texxt'] = array(
'#type' => 'textfield',
'#title' => 'test',
'#default_value' => 5,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}