Mobile app version of vmapp.org
Login or Join
Ann8826881

: How to deal with multiple step forms where one of the forms are not submitted Say you have a submission process that requires two forms. The submission of the 2nd form triggers an email. What

@Ann8826881

Posted in: #WebDevelopment

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: Clarity

Form 1 User submits general data

Message 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.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Ann8826881

3 Comments

Sorted by latest first Latest Oldest Best

 

@Sarah324

AS you describe, you should have a state of the process in your database to identify which steps have been completed..

Now, the next step depends on the technology used..

For ASP / ASP.NET there is an event triggered (server-side) when the session expires, and catching it you can perform the clean-up/auto-completion of the procedure..

Not sure if this is possible in PHP environments though .. i suppose you could store a timestamp once the 1st step is completed and a cron job will periodically run but first check against the timestamp to see if a set amount of time has passed before auto-completing ..

10% popularity Vote Up Vote Down


 

@Angela700

It depends on why you are concerned about this.

If your concern is about having incomplete data in you DB I'd suggest just keeping the entered data in the user session until the user completes the second form and then update the DB and send the e-mail. If the user doesn't bother to fill out the second form, then the entire exchange will be forgotten once his session times out.

If your concern is about users failing to realize that they need to complete the second form you should strongly consider redesigning the forms (possibly merging them). This is a user interface issue.

Having a flag (as discussed in question) could help identify if this happens, but it wont tell you if it is happening through user error or simply because the user lost interest (unless you have a captive audience of some sort).

An alternative, if you can hook into when a user's session expires (this is fairly simple with Java sites, I'm not familiar with this feature in other server side technologies) you could check for incomplete transactions at that point.

10% popularity Vote Up Vote Down


 

@Eichhorn148

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme