Builds a form to test the required attribute.
function form_test_required_attribute($form, &$form_state) {
foreach (array(
'textfield',
'textarea',
'password',
) as $type) {
$form[$type] = array(
'#type' => $type,
'#required' => TRUE,
'#title' => $type,
);
}
return $form;
}