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 #1593

Closed
3 tasks
dubdabasoduba opened this issue Sep 5, 2022 · 3 comments
Closed
3 tasks
Labels

Comments

@dubdabasoduba
Copy link
Member

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

@pld
Copy link
Member

pld commented Sep 6, 2022

Is this a fhircore or android fhir sdk issue?

@f-odhiambo f-odhiambo added Quest eCBIS The FHIR Last Mile Health Project labels Sep 9, 2022
@dubdabasoduba dubdabasoduba removed the eCBIS The FHIR Last Mile Health Project label Sep 13, 2022
@dubdabasoduba
Copy link
Member Author

Is this a fhircore or android fhir sdk issue?

@pld this is an SDK issue. I added this for easier tracking of the SDK issue. This affects all implementations

@f-odhiambo
Copy link
Contributor

This is done in PR google/android-fhir#1610. The validator would not perform any validation on hidden fields. You can use this via our published SDK artifacts CC @dubdabasoduba

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

No branches or pull requests

3 participants