opensrp / fhircore

FHIR Core / OpenSRP 2 is a Kotlin application for delivering offline-capable, mobile-first healthcare project implementations from local community to national and international scale using FHIR and WHO Smart Guidelines on Android.
https://smartregister.org
Apache License 2.0
50 stars 39 forks source link

Show a confirmation dialog after the user tap the submit button #3326

Open FikriMilano opened 2 weeks ago

FikriMilano commented 2 weeks ago

Describe the feature request. User accidentally tap the Submit button once they reach the end of the form, since they tap the Next button of each page super fast. Show a confirmation dialog to make sure whether the user wants to submit or is it an accident.

Additional context

Acceptance criteria

Area path A list of ordered steps in the app on usage of the feature to support anyone testing it e.g. Code reviewer, QA e.g.

  1. Open a form
  2. Tap next button until reach the last page
  3. Tap the submit button
  4. Show confirmation dialog
  5. Tap submit button in that dialog

Implementation plan (For Engineers) The plan for implementing the solution e.g. via a description or a check list for the various ordered tasks that will need to be completed. i.e. Describe how you intend to solve the problem

  1. Create a dialog fragment for the submission confirmation
  2. Show that dialog if the submit button (within the form) is tapped , put this code in the fragment result listener (FHIRCore) which connects to the QuestionnaireFragment's (SDK) submit button
  3. Move the code to process submission in it's own method so it can be re-used in 2 cases: immediate submission after the submit button (within the form) is tapped, and the submission through the confirmation dialog
  4. If the submit button in the dialog is tapped, then process the submission. If the cancel button is tapped, then close the dialog
  5. Before all that, check the config and have a condition in the fragment result listener (FHIRCore) whether to show the confirmation submission dialog after tapping the submit button or not (I put this at the bottom since putting it in the top seems overwhelming, making it confusing)
FikriMilano commented 2 weeks ago

@pld @f-odhiambo let me know if this technical approach can be approved. cc @AngelaKabari

pld commented 2 weeks ago

Looks good! For the confirmation window, what text will show in that? Is it possible to show a summary of the information that will be submitted?

Gental-Giant commented 2 weeks ago

Looks good! For the confirmation window, what text will show in that? Is it possible to show a summary of the information that will be submitted?

SDK implemented this where users would get a summary of all the information. I have also seen it implemented on Malawi CORE

Gental-Giant commented 2 weeks ago

There was a request on WDF to have a pop-up dialog based on certain values being recorded on the questionnaire fields. For instance, if we recorded a high bp reading (Sy 150) we would have a pop-up requesting the user to confirm a hypertension diagnosis

FikriMilano commented 2 weeks ago

@pld I'm planning something simple like: Are you sure you want to submit this form? But that's related to UX writing so I'll let @rowo to decide.

Summary of the information that will be submitted(?). Well, it depends on how you define summary. Is that information from a text field within the form? Or, something else?

pld commented 2 weeks ago

@FikriMilano have you tried the version in the SDK that @Gental-Giant mentioned?

FikriMilano commented 2 weeks ago

@pld From the latest change in SDK's master branch, the only other way to show a dialog when user tap the submit button is to use the Error dialog. It will only show if there's validation error in the questions, for example: a question is set as required but user does not answer that question, that question will be shown in the Error dialog. If the question passes the validation error, that question will not be shown in the Error dialog.

I could change the strings in the xml to make the dialog look like it's not an Error dialog. If that works for us then I guess we don't need this new feature.

The original Error dialog

Screen Shot 2024-06-12 at 06 32 18

The Error dialog after I change some of it's static strings in xml

Screen Shot 2024-06-12 at 06 31 20
FikriMilano commented 2 weeks ago

SDK implemented this where users would get a summary of all the information. I have also seen it implemented on Malawi CORE

@Gental-Giant could you perhaps send a recording to clarify on what you mean?

Gental-Giant commented 1 week ago

After recording all the responses, the last screen summarises what was captured. Users have the option to edit or save. Tapping edit allows users to go back to the previous page to update their responses. On tapping save, a confirmation dialogue pops up.

I have attached a recording of the same. cc @pld @FikriMilano

https://github.com/opensrp/fhircore/assets/52551080/80714524-0fdd-4262-bc72-413fcfaee1b6

pld commented 1 week ago

thanks @Gental-Giant! @LZRS is the code for that custom to mwcore or is it in fhircore/android fhir sdk?

LZRS commented 1 week ago

It's part of the android fhir sdk, when you set showReviewPageBeforeSubmit true in the QuestionnaireFragment.builder(). For mwcore, we set it here depending on whether the questionnaire is paginated

pld commented 1 week ago

OK awesome, thank you @LZRS, @FikriMilano can you please take a look at this and let us know your thoughts on this? thank you!

FikriMilano commented 1 week ago

Thanks all! I will have a look tomorrow.

If we're fine to not use a dialog, I guess this is ok, it has the summary/read only mode too. Though, @rowo mentioned we might use a snackbar instead for UX reasons.

FikriMilano commented 1 week ago

@pld @Gental-Giant @AngelaKabari I've tried it on engage and my notes are:

  1. The review feature works, but not for dynamic question text, which we use a lot on engage (see the missing score on the right image)
  2. calculated-expression (dynamic answer) works nicely, I'm happy w that
  3. The review feature is not configurable through our QuestionnaireConfig yet, but we can easily do that
  4. There are times we should not display a question text such as the Tip text on the right image, since it does not provide any useful information for the user to summarize (but this is a subjective opinion, it might be just me) Screen Shot 2024-06-14 at 16 11 55 Screen Shot 2024-06-14 at 16 11 34
Gental-Giant commented 1 week ago

Thanks, @FikriMilano For the feedback.

1 and 4 are valid use cases we want to design for. I think we should have SDK ticket items for them. cc @pld