We have a site where either authenticated or unauthenticated users can submit a form. When the form is validated, we check whether they are logged-in, and if not, we redirect them to authenticate, with a destination parameter of the original page. At this point, we cache the $form
and $form_state
in $_SESSION
.
After authentication and redirection the form is redisplayed on the page (by retrieving the $form
from $_SESSION
) and ask them to confirm the submit.
Note the form is dynamically-generated which is why we have to store it.
What I can't seem to do on redisplay is set the form values to the choices that the user previously made, even though these are stored in the cached $form_state
. What is the best way to do this?