开发者

Saving user form data between sesisons

I am looking for suggestions on the best way to save data for a multi-page user form between sessions. I am using c# 3.5 and SQL server 2008

The form is currently in a state where you have to complete the entire form, I would like to change it so that the form and data can be saved and resumed from some point and looking for sug开发者_如何学Pythongestions, best practices etc..


Assuming that this is a webapp, you will need to store the fields in a database. On each page of the form, include a "save" button that will take the currently visable fields and store them in the database. Also have a "next page" button. On the last page, include a "submit" button. On click, this will retrieve all the fields in the form database and submit it to create a new entry in a new table in the database (e.g. CompletedFormTable)

You must also do one more thing. You must include the id of the form on each page so that you can identify the form data in the database. There are several ways of doing this.

  1. Add a session cookie to the user's browser. Include a "session cookie" field in the form table to identify where the form data should go.
  2. Include a hidden field in the form that references the "id" of the entry in the database.
  3. Store everything on the browser (json object) and use ajax so that you don't have to reload the page. Instead of entering everything in a table, you can just update the json object. On submit, you send the json object to a server,which will then create an entry in a database for storage.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜