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

[Form Validation] Hidden Required fields should not be validated #1579

Closed
3 tasks
dubdabasoduba opened this issue Sep 5, 2022 · 1 comment · Fixed by #1610
Closed
3 tasks

[Form Validation] Hidden Required fields should not be validated #1579

dubdabasoduba opened this issue Sep 5, 2022 · 1 comment · Fixed by #1610
Assignees
Labels
effort:small Small effort - 2 days P1 High priority issue type:bug Something isn't working

Comments

@dubdabasoduba
Copy link
Collaborator

dubdabasoduba commented Sep 5, 2022

Describe the bug

  • Currently, when a field on the Questionnaire is hidden the Required validation check is still applied to it.
  • This means the user will get an error prompting them to fill all required fields. The user is however not able to fill in the field since it's hidden.

To Reproduce
Steps to reproduce the behaviour:

  1. Add a Required field in a questionnaire.
  2. Fill up the questionnaire and try to submit it.
  3. An error asking the user to confirm that all the fields were filled up will be thrown.

Expected behaviour

  • All visible required fields should be validated
  • All hidden required fields should not be validated on submission.

General Implementation Idea

  • We should not validate any field when the value of the hidden extension is set to true
    • This means we first check for the hidden extension and then run validation on the field.

Assumption

  • Skip Logic also uses the hidden extension to also hide/show fields.

Screenshots
https://user-images.githubusercontent.com/4817531/188339502-7f9d17a0-7292-4412-ba86-bc97687e985d.mp4

Hidden field JSON

{
  "linkId": "83943853-d9c9-46ad-da39-2cc55e93b974",
  "type": "integer",
  "text": "Birth weight",
  "required": true,
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden",
      "valueBoolean": true
    }
  ]
}

Smartphone (please complete the following information):

  • Device: Emulator & Xiaomi 11T Pro
  • Android version: 10 & 12

Related SDK Issue

@maimoonak
Copy link
Collaborator

Done in PR #1610 . The validator would not perform any validation on hidden fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:small Small effort - 2 days P1 High priority issue type:bug Something isn't working
Projects
Status: Complete
Development

Successfully merging a pull request may close this issue.

3 participants