Environment
Spring/hibernate/MySQL web application
Problem
I have a multi-step form which should be savable at every step for completing later. But incomplete steps may contain fields that are required for the model, making it not possible to save the model.
What I have tried or thought about trying
But..
Solution 1 disrupts database design, and solution 2 will bloat my code with fragments to convert between the temporary model and the permanent one, and this will get ugly if I add the ability to edit the form after saving it.
How to implement the complete later feature in a way that is seamless and elegant?
Another option is to have a boolean
column in your database table complete_edit
. and for those columns that are not entered in first place during save, either store default value or a string like "NOT_COMPLETE" and set complete_edit
column as false. Only on submit this column should be true.
FWIW, I am strongly against temporary table to save incomplete form. We have a similar set up in our current application (to prepare invoices in multiple steps that could span different user sessions) that's posing maintainability issues and incoherent modifications to the temporary and permanent tables.
We are moving towards a single table approach with discriminator status column that would classify these in-progress-invoices such that they are not picked by the subsequent workflow steps until the status is flipped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With