-
Notifications
You must be signed in to change notification settings - Fork 6
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
CARDS-2580 - Number question: allow min/max value to be specified but not enforced #1810
Conversation
… not enforced Enable marckdown in validation messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
… not enforced Addressing review comments - use the default message when min/max values are enforced.
When enforcing min/max is enabled, the error msg shows up:
This is due to the existing behavior, when error msg is blank and we display the old message. Can we just ignore the text in the error msg in this case ( when enforcing min/max is enabled)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested
The code has been updated in 2bb40f1 to have the exact same behavior as before (no custom message). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This behaves slightly different from enforced ranges:
- In enforced ranges, the text is validated as it is typed, so if minValue=10, typing 2 will trigger the error, typing 20 will remove the error. In optional ranges, the error is triggered only when the input loses focus, but the error is removed while typing if the value becomes valid.
- In optional ranges, the bottom line of the input also turns red, which I like, we should do that for enforced ranges as well.
- If the error message is displayed, deleting the whole value doesn't clear the error message, it still appears to be invalid, but in enforced ranges an empty input is considered valid (if minAnswers=0).
- Is this a regression, or was it always like this? If I "Hide answer instructions", the error message for enforced ranges is never shown.
modules/data-entry/src/main/frontend/src/questionnaireEditor/Question.json
Show resolved
Hide resolved
… not enforced Addressing review comments - clear the error for soft limits when the value is empty
… not enforced Addressing review comments - give the input an error state (red border) when the value is outside enforced limits
I can add the
Updated.
Updated.
It has always been like this. |
… not enforced Addressing review comments: fixed "when opening a new form with no answers, the unenforced answers start as invalid"
… not enforced Addressing review comments: * Bugfix: soft min/max values are enforced for multivalued answers * Regression: hard min/max values are no longer enforced for multivalued answers
… not enforced Addressing review comments: allow negatives regardless of minValue if not enforced
Addressed in 2fea07e .
Adressed in 806b87f .
This is what we want. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well enough, on par with dev. Some things noticed while testing:
- number, single value, enforced range: entering an out-of-range number will save this invalid value when saving the form
- number, multiple values, enforced range: entering an out-of-range number and leaving the field does not accept the value, and does not save it when saving the form
- text, multiple values, validation regexp: entering a non-matching value will still accept and save it
- in view mode out-of-range numerical values aren't displayed as invalid, but non-matching text values do display the invalid-regexp message
For consistency, we should allow out-of-range numerical values to be saved if entered, and we should display the error/warning messages in view mode.
+1 |
Includes a test questionnaire
Number Min / Max Value Test
.