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

Backend Changes for Customizable Confirmation Screen #5112

Open
wants to merge 1 commit into
base: beta-refactored
Choose a base branch
from

Conversation

rajpatel24
Copy link
Contributor

@rajpatel24 rajpatel24 commented Sep 17, 2024

Checklist

  1. If you've added code that should be tested, add tests
  2. If you've changed APIs, update (or create!) the documentation
  3. Ensure the tests pass
  4. Make sure that your code lints and that you've followed our coding style
  5. Write a title and, if necessary, a description of your work suitable for publishing in our release notes
  6. Mention any related issues in this repository (as #ISSUE) and in other repositories (as kobotoolbox/other#ISSUE)
  7. Open an issue in the docs if there are UI/UX changes

Description

This PR implements the backend changes for a customizable confirmation screen feature in Enketo, enhancing the user experience by providing personalized feedback based on their survey responses. The changes enable OpenRosa to dynamically extract and return customized confirmation messages, leveraging the flexibility of XLSForm's calculation capabilities.

The feature utilizes the kobo:submitResponseMessage attribute, allowing form designers to specify the XPath to the element containing the confirmation message. This PR modifies OpenRosa to recognize and extract this XPath, retrieve the corresponding message from the XML submission payload, and return it in the 201 response.

Notes

  • Modified OpenRosa to recognize and extract the XPath from kobo:submitResponseMessage attribute
  • Used extracted XPath to retrieve confirmation message from XML submission payload
  • Updated OpenRosa's 201 response to include the extracted confirmation message
  • Handled edge cases where the attribute is missing or references a non-existent XML element

@rajpatel24 rajpatel24 force-pushed the customizable_confirmation_screen branch from d8f8458 to f11a723 Compare September 17, 2024 12:37
@tiritea
Copy link

tiritea commented Sep 17, 2024

Note, it is probably worth double-checking that the ODK COllect/KoboCollect mobile client ignores - or is otherwise not negatively impacted - by having a non-empty <message> in the <OpenRosaResponse> body; see https://bitbucket.org/javarosa/javarosa/wiki/FormSubmissionAPI

Specifically, the <message> should either be completely ignored by Collect (eg Collect always just presents a boilerplate post-submission success text) or Collect just displays whatever text is returned in this string, markup chars and all. If Collect does anything else, that probably suggests an ODK Collect bug/issue that needs further investigation.

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

Successfully merging this pull request may close these issues.

2 participants