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

Handle required fields in questionnaires #470

Closed
jingtang10 opened this issue May 12, 2021 · 9 comments · Fixed by #511
Closed

Handle required fields in questionnaires #470

jingtang10 opened this issue May 12, 2021 · 9 comments · Fixed by #511
Assignees
Labels
good first issue Good for newcomers P1 High priority issue type:enhancement New feature or request
Milestone

Comments

@jingtang10
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Handle the required field in the questionnaires: https://www.hl7.org/fhir/questionnaire-definitions.html#Questionnaire.item.required

Describe the solution you'd like
Add a validator so that if a required field is not filled in display some kind of warning.

Describe alternatives you've considered
NA

Additional context
NA

Would you like to work on the issue?
NA

@jingtang10 jingtang10 added type:enhancement New feature or request good first issue Good for newcomers labels May 12, 2021
@jingtang10 jingtang10 added this to To do in Data capture library via automation May 12, 2021
@FikriMilano
Copy link
Collaborator

Hello @jingtang10 , this is my first appearance in this community. If you don't mind, can I give this issue a try? I have been searching issue with "good first issue" tag on it and finally found one 😄

@jingtang10
Copy link
Collaborator Author

Sorry @FikriMilano we assigned this item to @kunjan8794. Please take another look at the open issues. thanks!

@FikriMilano
Copy link
Collaborator

That's alright @jingtang10 , I will find one eventually. Best of luck @kunjan8794 👍

@kunjan8794
Copy link
Collaborator

@jingtang10 Do we need to display a warning when the user is filling the questionnaire, or essentially only after user clicks on the SUBMIT button?

@jingtang10
Copy link
Collaborator Author

@jingtang10 Do we need to display a warning when the user is filling the questionnaire, or essentially only after user clicks on the SUBMIT button?

I think it makes sense to display a warning when the item loses focus (in the case of an edit text at least).

In the case of radio button or other types, it's harder. I agree we might need to reply on validation upon page change or upon submission. But that can be left to do in a follow-up.

@fredhersch
Copy link
Collaborator

I think we will need to look at how to support custom error messages and translations

  • Is there an extension for validation error messages that can be used with translations?
  • Alternatively may need to implement something with the SDK for common validation messages and use of the strings.xml for languages

@fredhersch
Copy link
Collaborator

Thanks @kunjan8794 For handling the error messages back to the UI, we agreed to define a set of CONSTANTS within the strings.xml for each field type that can then be translated by implementers

@jingtang10 to propose update to FHIR Spec to handle this in the future

@kunjan8794
Copy link
Collaborator

@jingtang10 I might have to pass the Context to the Validators in order to access string resources. I was able to do that but was confused and unable to do that in the unit tests. Can you suggest something here?

@jingtang10
Copy link
Collaborator Author

@jingtang10 I might have to pass the Context to the Validators in order to access string resources. I was able to do that but was confused and unable to do that in the unit tests. Can you suggest something here?

do you have a draft PR?

i think in the test you normally have access to the test context too? if not can you mock it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers P1 High priority issue type:enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants