We have a web application based on the form that passes. Unfortunately, when people look at it, it is edited. Thus, two people can edit it at the same time and overwrite their changes. How would you lock a form (and any several parts of the same form, because it is divided into several pages), so only one person can edit it at a time?
We want them to be able to edit the form for half an hour with one shot (they can save and continue to add more time).
I have one solution, but I wanted to see what other people think.
In my solution, when the user first looks at the form (or any parts of the form, because there are several parts that all need to be blocked), none of the fields can be changed until they hit the edit button. As soon as they press the edit button, a flag is entered with the user ID and start time. Then they are redirected to the same view that is editable. A javascript timer will be set at the bottom of the page to tell them how much time they have left. When they are finished, they click the "Save and Exit" button to save the changes, unlock the form for other users and return to the unprocessed form. To avoid using the back button to return to the editable form, I think an intermediate page containing javascript redirection will be used. Therefore, if they click the back button, they will simply be redirected back to the current page.
If they want to edit one of the subforms (there are buttons that redirect them to subforms from the main form), they can simply click one of these buttons in edit mode and it will save a large form, update the time to give them another half hour and redirect them to the editable subformat.
When a user tries to view a form that is currently being edited by another user, the edit button will not be available and the current user's information will be displayed along with the time when it should be open, but this time can be changed by the user when saving and editing the subform.
Does this sound like a viable solution? If you had to do the same, please let me know what is your solution to the problem?
java-ee
scheibk
source share