See function drupal_process_form (form.inc), the following part:

    if ($form_state['submitted'] && !form_get_errors() && !$form_state['rebuild']) {
    	// Execute form submit handlers.
      form_execute_handlers('submit', $form, $form_state);

When I create a form programmatically and make it ready to be submitted, I notice that it fails because the submitted is FALSE by default.

The following can be found in drupal_form_submit

  // Programmed forms are always submitted.
  $form_state['submitted'] = TRUE;

Judging from above, $form_state['submitted'] has the meaning 'If TRUE, the form must be submitted'.

But this is in conflict with the documentation about the form_state (documentation of drupal_build_form):

 *   - submitted: If TRUE, the form has been submitted. Defaults to FALSE.

What does the submitted property really mean?

Comments

mgifford’s picture