In order for my users to submit their forms, all of the fields must be complete. However, there’s a lot of fields, so I’d like them to be able to save the data as a draft and continue later.
I tried to achieve this by having two buttons: a save-draft button and a submit-final button, with a “status” field in the database item.
Ideally, I’m trying to accommodate the following 3 scenarios:
- user presses save-draft > inputs are saved to database
- user presses submit-final AND no inputs are empty > inputs are saved to database AND field “status” is set to “final”.
- user presses submit-final AND some inputs are empty > inputs are saved to database BUT field “status” is not set to final. The user is informed that all fields must be completed.
In my current attempt, I have two workflows:
*When the user presses save-draft, it saves a state called “is_final” as “no” and then calls make-changes-to-a-thing to save the data in the database.
*When the user presses submit-final, it saves the “is_final” state as “yes” and then calls make-changes-to-a-thing to save the data in the database and also sets the field “status” to “final”.
I also have conditional formatting to accompany this:
*when is_final = yes, every field is set as must not be empty = checked.
*when is_final = no, every field is set as must not be empty = unchecked.
However, I have now realised that the conditional formatting is only being updated when make-changes-to-a-thing is successful in the workflow (I assume because this resets inputs?).
This means that, when I press the submit-final button, it sets the “is_final” status as “yes”, calls make-changes-to-a-database successfully, updates the inputs, and only then is the “is_final” state change recognised by the conditional formatting of the inputs.
Of course, if the user presses this when not all fields are complete, this breaks the save-draft functionality because all fields have been set to “must not be empty”, so the state change at the start of the save-draft workflow (“is_final” = no) will not be recognised by the conditional formatting unless all fields are complete.
I’m aware I’m probably over complicating things, so I’d really appreciate any ideas or solutions you may be able to offer. Any and all suggestions are welcome.
I didn’t like resorting to auto-binding as it doesn’t give me complete control but perhaps it is my best option here?
Thank you in advance.