Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Finish Later" button to forms opened in Participant mode #39

Open
malcjackson opened this issue Apr 6, 2023 · 11 comments · Fixed by OpenClinica/enketo-express-oc#687
Assignees
Milestone

Comments

@malcjackson
Copy link

malcjackson commented Apr 6, 2023

When a form is opened in the Participant flavor there is no option built into the form to close it without evaluating for errors and come back later to finish. Adding something like this to Participant-mode forms would help guide those users and improve their experience.

  • Add a button labelled "Finish Later" that appears on every page of the form when a form is opened in Participant-mode
  • On the last page "Finish Later" appears above the "Close" button
  • The "Close" button must be made (if not already) to get its label from a different location for Participate than for other modes of the form with a new label of "I'm Done"
  • This button does not appear in any other form mode
  • When clicked, this button must close the form without checking for any errors.
  • This new button must not send the same postMessage to the parent window as the Close button sends.
@pbowen-oc pbowen-oc added this to the Next milestone Apr 6, 2023
@MartijnR
Copy link
Member

MartijnR commented Jun 26, 2023

single page, full XML record submission: http://localhost:8005/single/full/participant/ecc3bb1f8ede1cf154664522e3f0f2c9?ecid=1
multi page, fieldsubmission : http://localhost:8005/single/fs/participant/i/4fcdc642867b2409d083074536eb9b1c?ecid=1

  • add button only for fieldsubmission Participate views
  • describe new postMessage message
  • change text of existing button to 'I'm done'

test message received by iframe parentWindow:

http://localhost:8005/dev?iframe=http%3A%2F%2Flocalhost%3A8005%2Fsingle%2Ffs%2Fparticipant%2Fi%2F4fcdc642867b2409d083074536eb9b1c%3Fecid%3D1%26parentWindowOrigin%3Dhttp%253A%252F%252Flocalhost%253A8005

@MartijnR
Copy link
Member

MartijnR commented Jun 26, 2023

@pbowen-oc, @malcjackson we have full-XML-record Participate views (incl offline-capable ones) and fieldsubmission Participate views. Should this new feature (including the new button text for the existing Submit/Close button) be for all of them?

@MartijnR
Copy link
Member

@pbowen-oc, @malcjackson, should any confirmation dialog be shown before exiting? If so, what should be the text?

@pbowen-oc
Copy link

@MartijnR - This feature should only be added to our standard field submission Participate views. It would not be relevant for our online anonymous view and the offline view already has a button to save as a draft (which creates a similar effect to this new Finish Later button).

I don't think there is a need to have a confirmation dialog since the user will see a button to resume form data entry on the page they go to after the form closes from Finish Later.

@MartijnR
Copy link
Member

MartijnR commented Jun 28, 2023

The message sent to the parentWindow is the same as the 'close' message except that the enketoEvent is 'exit' instead of 'close'.

kkrumlian referenced this issue in OpenClinica/enketo-express-oc Jul 12, 2023
…pate-674

added ‘Finish Later' button in fieldsubmission Participate views, kobotoolbox#674
@malcjackson
Copy link
Author

We are currently seeing some unexpected behavior with the relabeled "I'm Done" button.

  1. Open a multi-page form as a Participant
  2. The first page shows both the I'm Done and Finish Later buttons
  3. Update any data item
  4. "I'm Done" disappears

The expectation is that I'm Done always only appears on the last page of the form.

FYI
@MartijnR @pbowen-oc @kkrumlian

@MartijnR
Copy link
Member

I believe this indicates a build issue. It looks like the CSS didn't build successfully. See below for the webform URL (regular Participate view, I believe) I am using to test.

Screenshot 2023-12-21 at 2 23 11 PM

@pbowen-oc
Copy link

@theywa - Can you work on this?

@theywa
Copy link

theywa commented Jan 4, 2024

Hi @MartijnR ~ I found the reason is in css like you said. The trigger is this class
.empty-untouched

on line 433 on _common-oc.scss that added on f3d64f0e206b4b9e2912644f17e7a206334f54ad

.pages.empty-untouched~.form-footer { .form-footer__content { &__main-controls { #close-form.participant { visibility: visible; } } } }
I'm not sure why that class added only in these file
Onboarding Survey version 2.xls
form.xml.txt
some other files that I use did not include that class when rendered and the feature works as expected.

Do you have a suggestion/opinion about this issue or how to fix it?
Thanks in advance

@MartijnR
Copy link
Member

MartijnR commented Jan 5, 2024

Oh interesting find.

As you likely noticed, this class is set here, and is for empty Participate Fieldsubmission-type forms (not when editing a record). It is removed here when a dataupdate event fires.

It looks like this feature/hack relates to some new RFC views (introduced in that same commit) #100.

As to why it only causes a problem for some forms, I wonder if that is because a calculation causes a dataupdate event that removes that class.

I wonder if the solution is to tweak that if() statement clause that sets the empty-untouched class. You'd need to figure for which type of Participate views that feature to show a Close button on every page is still required (e.g. maybe by adding && settings.reasonForChange, but I don't know for sure).

I hope that helps!

@theywa
Copy link

theywa commented Jan 9, 2024

Thank you @MartijnR, that is very helpful. After taking a look at the code your suggestion makes sense and after testing, that update fixes the issue. I also found out, why only that form has the issue. because that form does not have any calculated item that will trigger auto-saving the first time we open the form. By auto-saving the form type will be changed to "edit"(that will remove the 'empty-untouched' class).
If you have spare time please review the PR thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants