Closed berleant closed 5 years ago
Users should be able to edit the form while is Incomplete, I'll update the acceptance criteria and move this to the backlog
I think the easiest thing would be to simply hide the "save for later" button after the form has been submitted the first time. If the user needs to edit the information, they will have to use the "submit for review" button to do so.
Why is the form not saving in first place?
The "Save" button saves the info under the _forms
key, and the "Submit" button saves the info under the forms
key (https://github.com/debtcollective/parent/issues/121). When the form modal is displayed, the template uses the data from the forms
key, if it exists (else _forms
). So the information is being saved, but it is not being displayed and there is no way to access it.
I understand. I think we can solve this by saving the data in theforms
field always. We won't continue with the dispute process if the dispute status is incomplete, which is changed after you submit the form, so is safe to do that.
OK, sounds great! That's almost exactly what I was thinking in the other ticket. Great minds think alike :)
@shoshber about Add a key validated
for each form, what's the idea behind it?
There are cases where, without a validated
flag, it would be impossible to tell if the form had been validated before (i.e. user clicked "Submit" button). This is important because once the fields have been validated, they should not be changed to non-valid values, so every time the data is persisted ("save" OR "submit" button) it needs to be revalidated.
We don't want to validate the fields if the user is saving the form for the first time, though, because they might need to stop filling out the form, save, and finish filling it out later. This could happen because they need to go find info or their computer session is over.
@shoshber
This is important because once the fields have been validated, they should not be changed to non-valid values
We do validations in the backend when you click save, if the forms has error it won't be saved. Not sure if that's enough. Also, if the user hasn't submit for the first time, the form will be empty.
Currently, when the user clicks "save", it is not validated in the front end or the back end.
https://github.com/debtcollective/dispute-tools/blob/development/models/Dispute.js#L275
Without the validated
flag (or _forms
), if a user starts a new dispute, then clicks "save", the data will be indistinguishible from a user who started a new dispute, then clicked "submit".
Just FYI, I am working on other higher-priority tasks but I will get back to this when I can.
Spec approved offline
Closing this as we are leaving the current dispute-tools repo in maintenance mode
Reproduce
Make a dispute. Fill out and submit the information form. Re-open the information form modal and modify a field (not in the "Amount of Debt Disputed" section). Click the save button. Refresh the page (or navigate away). Come back to the dispute page. Open the information form--the field has the same value as before.
savebutton.mov.zip
https://gist.github.com/shoshber/1252deb83df4a8ece487bf5470913da3