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

O3-2057 Add support to display error messages on Number input control #22

Merged
merged 4 commits into from
Apr 19, 2023

Conversation

kajambiya
Copy link
Collaborator

This PR fixes the issue where there's an error on the number field and field is highlighted in red but no error message is displayed.

Screenshot 2023-04-17 at 16 43 50

Comment on lines 428 to 443
if (field.questionOptions.rendering == 'number') {
let min = field.questionOptions.min;
let max = field.questionOptions.max;
if (min && Number(value) < Number(min)) {
errors.push({
resultType: 'error',
message: `Field value can't be less than ${min}`,
});
if (max && Number(value) > Number(max)) {
errors.push({
resultType: 'error',
message: `Field value can't be greater than ${max}`,
});
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to the default validator

@samuelmale samuelmale merged commit 15486b8 into openmrs:main Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants