I'm writing a module that will be inserted into the ecommerce checkout process using the checkoutapi() hook. When called, this module scans the contents of the cart, identifies items that we need to capture additional information for, and generates a form to collect that information. When the form is validated and an error in the input is found, I use form_set_error() to highlight the appropriate fields. However, when this happens, all values on the form reset to their default values! Since the form can be long, I would much prefer that the form keep the values the user entered while highlighting the fields that have errors so that they don't have to reenter all their information.
How can we prevent the form from resetting itself to default values when we use form_set_error()?
P.S. For further clarification: We use the ecommerce system to allow people to pay for summer camp fees, so we want to be able to capture information such as their name, age, dietary restrictions, and special needs when registering for a summer camp.