Say you have a submission process that requires two forms. The submission of the 2nd form triggers an email. What do you do if the second form isn't submitted? Say the user forgets or closes the window by accident.My only solution was to update the DB with a flag from the submission of the 1st form that identifies an email has not been sent. Submission of the 2nd form will trigger an event to send an email and update the DB with a flag that identifies an email has been sent. A cron job will run periodically to check for any flags for unsent emails, gather the information, and send an email.Is this the best way of dealing with the issue?Thanks.Edit: ClarityForm 1 User submits general dataMessage 1 User presented with a choice. User needs to choose to pass or accept. If the user submits the accept form (Form 2), an email is sent. If the user submits the pass form (Form 2), they are presented with another message with another choice (Form 3). If the user does nothing, the last choice provided is their default choice, but at this point an email still needs to sent.I hope that's more clear.
How to deal with multiple step forms where one of the forms are not submitted
web development
Since HTTP is stateless, the only way to track whether a user has submitted the first form once the browser is closed is by using a persistence mechanism (e.g., a database) just as you have done.However, you may run into a problem if users submit the first form and the cron job runs before they have a chance to submit the second form.  You may want to also check that a certain amount of time has also passed.Theoretically you could also try to detect when the browser is closing and use that event to trigger an action, but I advise strongly against it.