Oct 17th, 2011, 9:46 PM
Hey Dave,
This is something that I've done myself dozens of times for our own clients - and something I ultimately hope to solve once and for all with the Form Builder module (but not in the first release, sorry!).
So yes, you can totally do it. Since the API stores the info for all form submissions - incomplete or not - the issue is really a matter of how the user first gets to the form. What I always do is add a "login page", which contains a unique identifier of some form - usually the user's email - and a default password. Then, when they submit that form, it does a custom query against the database. If it finds the record, it manually sets that data in sessions - just as it would do automatically with the API for new submissions. Then, when they redirect to page 1 of the form, it contains those values.
For the other case - new registrants - the query would fail to find that user's email, so just run the API's create blank submission function and redirect.
It's kind of top level advice, but that's the general idea.
A slightly easier solution would be to use the Submission Accounts module. In your public form, pass the "finalize" => true key-value pair to the ft_api_process_form() function on the first form page, and add the "may_update_finalized_submissions" => true to all subsequent pages. With that in place, the submission will automatically appear in the FT interface after page 1 - even if it's incomplete. You could then use the Submission Accounts module to let them log in there and complete filling in their submission.
- Ben
This is something that I've done myself dozens of times for our own clients - and something I ultimately hope to solve once and for all with the Form Builder module (but not in the first release, sorry!).
So yes, you can totally do it. Since the API stores the info for all form submissions - incomplete or not - the issue is really a matter of how the user first gets to the form. What I always do is add a "login page", which contains a unique identifier of some form - usually the user's email - and a default password. Then, when they submit that form, it does a custom query against the database. If it finds the record, it manually sets that data in sessions - just as it would do automatically with the API for new submissions. Then, when they redirect to page 1 of the form, it contains those values.
For the other case - new registrants - the query would fail to find that user's email, so just run the API's create blank submission function and redirect.
It's kind of top level advice, but that's the general idea.
A slightly easier solution would be to use the Submission Accounts module. In your public form, pass the "finalize" => true key-value pair to the ft_api_process_form() function on the first form page, and add the "may_update_finalized_submissions" => true to all subsequent pages. With that in place, the submission will automatically appear in the FT interface after page 1 - even if it's incomplete. You could then use the Submission Accounts module to let them log in there and complete filling in their submission.
- Ben