Form API: Persistent values across submits? Getting started with the form API. None of the examples seem to keep and redisplay the values the user entered. E.g.,  you have a "name" field. User enters "John" and hits Submit.

If the form data is invalidated for some reason, the name field should still show "John" so he doesn't have to enter it again. Is there a setting to set for persistent values? values vs. default_values?

Drupal 7 stock install
In the Form API, there are two separate value setters #default_value and #value where these two make different things happen when you using it
- #default_value set the value of your element when the form is created the first time, and if your form has an error for some reason, does not affect your element
- #value set element value every time the form is rendered, even when the form is created again because of some error

It is not correct to use #value for textfields and other input elements, use #default_value instead. #value is meant only for buttons, submits and other non input elements.
if you use $form['#value'] = 'Name' for input elements like textfield the value of that field always would be Name even if the user entered some other value for this field.

see Form API Reference