We have a web application that is based around a form that gets passed around. Unfortunately when people look at it, it is editable. So two people can edit it at the same time and overwrite their changes. How would you go about locking the form (and any multiple parts of the same form because it is broken down into multiple pages) down so only one person can edit it at a time?
We only want them to be able to edit the form for a half hour in one shot (they can save and continue to add more time).
I have one solution, but I wanted to see what other people have thought of.
In my solution, when a user first looks at the form (or any parts of the form because there are multiple parts that all need to be locked down) none of the fields are editable until they hit the edit button. Once they hit the edit button a flag is entered with their user id and the start time. Then they are redirected to the same form that is editable. There will be a javascript timer at the bottom of the page to let them know how much time they have left. When they are finished they hit the "Save and Exit" button to save their changes, to unlock the form for other users, and to go back to the uneditable form. To avoid the use of the back button to return to the editable form I am thinking that an intermediary page that contains a javascript redirect will be used. So if they hit the back button they will be just redirected back to the current page.
If they want to edit one of the sub forms (there are buttons that redirect them to the sub forms from the main form) they can just click on one of those buttons in edit mode and it will save the big form, update the time to give them another half hour, and redirect them to an editable sub form.
When a user tries to look at a form that is currently being edited by another user, the edit button will be grayed out and the information of the current user will be shown along with the time it should be opened back up, but this time could be changed by the user upon saving and editing a sub form.
Does this sound like a viable solution? If had to do the same thing please let me know what your solution to the problem was?