function dbtng_example_form_add
Prepare a simple form to add an entry, with all the interesting fields.
Related topics
1 string reference to 'dbtng_example_form_add'
- dbtng_example_menu in dbtng_example/
dbtng_example.module - Implements hook_menu().
File
-
dbtng_example/
dbtng_example.module, line 471
Code
function dbtng_example_form_add($form, &$form_state) {
$form = array();
$form['add'] = array(
'#type' => 'fieldset',
'#title' => t('Add a person entry'),
);
$form['add']['name'] = array(
'#type' => 'textfield',
'#title' => t('Name'),
'#size' => 15,
);
$form['add']['surname'] = array(
'#type' => 'textfield',
'#title' => t('Surname'),
'#size' => 15,
);
$form['add']['age'] = array(
'#type' => 'textfield',
'#title' => t('Age'),
'#size' => 5,
'#description' => t("Values greater than 127 will cause an exception. Try it - it's a great example why exception handling is needed with DTBNG."),
);
$form['add']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add'),
);
return $form;
}