Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Add sanitizing number input #668

Merged

Conversation

captain-enjoyable
Copy link
Contributor

Fixes #116

This PR creates a number-input which sanitizes text to remove characters that are not numbers or a period. For example, if you were to paste "$1,000.00" into a number input it would change the value of the input to "1000.00".

With these changes it is now much easier to extend em-input and add any sort of sanitization desired in the future.

Outstanding Issues:
There are many countries, which use a comma as a decimal mark. This feature has the potential to cause confusion by removing commas which are important to actual value of the number e.g. "$100,00" one hundred dollars becoming "$10000" ten thousand dollars.

Country specific configuration seems like something that may be a frequent issue for an app of this nature. It may be worth spending some time thinking about how to add such a configuration to the system.

cc @HospitalRun/core-maintainers

Copy link
Contributor

@taras taras left a comment

Choose a reason for hiding this comment

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

It looks great. Thank you for changing all of the fields that use numbers.

@taras
Copy link
Contributor

taras commented Sep 27, 2016

@jkleinsc can you pls review this so we can get it merged in? I'd like to use this code for #51

@taras taras mentioned this pull request Sep 27, 2016
@jkleinsc
Copy link
Member

Thanks for the PR @MattEddy! I'm going to merge it in.

@jkleinsc jkleinsc merged commit 7c93e70 into HospitalRun:master Sep 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants