google / android-fhir

The Android FHIR SDK is a set of Kotlin libraries for building offline-capable, mobile-first healthcare applications using the HL7® FHIR® standard on Android.
https://google.github.io/android-fhir/
Apache License 2.0
485 stars 288 forks source link

Numeric input field accept the text input #1915

Open owais-vd opened 1 year ago

owais-vd commented 1 year ago

Describe the bug A Numeric input field is accepting other input as well instead of numbers only in the emulator like Text.

Component SDC library

To Reproduce Steps to reproduce the behavior:

  1. Go to any questionnaire.
  2. Click on any numeric field.
  3. Then type any letter.

Expected behavior A numeric field should only accept the numeric input either on an emulator or a physical device

Screenshots

https://user-images.githubusercontent.com/62104757/225644437-f1611087-14a6-4920-b8d7-38ceb218f351.mp4

Smartphone (please complete the following information):

omarismail94 commented 1 year ago

@owais-vd I think this is working as intended. The user can type in anything, but it wont get saved into the QuestionnaireResponse if it is invalid. Are you seeing the invalid text saved in the QuestionnaireResponse?

owais-vd commented 1 year ago

Hi @omarismail94 Yes you are right the end answer would be saved as an empty result in DB, so the idea is just to prevent the user input if getting invalid. here you can see my comment https://github.com/opensrp/fhir-resources/issues/934#issuecomment-1463656473

cc: @dubdabasoduba

omarismail94 commented 1 year ago

Im not sure if the link is invalid or leads to a private thread, but I cannot see your comment!

owais-vd commented 1 year ago

oh the repo is private but the whole idea is could we set a DigitsKeyListener instance in the edit-text field so that the user can only enter provide digits in text-field.

dubdabasoduba commented 1 year ago

@owais-vd I think this is working as intended. The user can type in anything, but it won't get saved into the QuestionnaireResponse if it is invalid. Are you seeing the invalid text saved in the QuestionnaireResponse?

HI, @omarismail94 is there a reason we are allowing this behaviour? My assumption would be if a field is marked as an integer-only field then we should even allow the users to type alphabets or symbols. If it is a float field we only allow integers and the .

owais-vd commented 1 year ago

Hi, @omarismail94 is there any update on https://github.com/google/android-fhir/issues/1915#issuecomment-1477574956 ?