I have created a simple form that displays a textfield and a submit button. The text field is defined:
$form['upload_file'] = array(
'#type' => 'textfield',
'#title' => t('File to read')
);
When I enter "test" in the textfield and select the submit button, the form moves on to the Validate function which has the following code:
$answer = $form_state['values']['upload_file'];
if (!$answer) {
form_set_error('upload_file', "Please enter a file name: ");
}
And I get the error message indicting that $answer is empty. Do I have the wrong array location for the stored textfield text? Or is there something else I need to do to place the values in the form ito the values array?