-
Notifications
You must be signed in to change notification settings - Fork 66
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
BigDecimalField handle currency formatted text replacement #106
base: 8.0
Are you sure you want to change the base?
Conversation
…mple currency). Previously, tabbing into the field and typing a number, when a currency is applied, would cause the number to fail validation and would revert to the last valid number.
Hi Jonathan, thanks, I’ll have a look into that and will come back to you. Cheers Thomas Am 25.01.2015 um 08:57 schrieb Jonathan Tinsman [email protected]:
|
Hi Jonathan, I see your point, but the problem is, that those signs (currency or
As a consequence/workaround I personally do not use units within the fields Does that make sense? Thomas 2015-01-25 8:57 GMT+01:00 Jonathan Tinsman [email protected]:
|
Issue: When tabbing through a form and into a BigDecimalField, the user would normally just type in the desired number for the field. If the BigDecimalField has a currency format (i.e. $100.00), when the user types in a number (i.e. 150), it fails format validation and does not take the new number.
Solution: I have updated the BigDecimalField to check if the input matches the format. If it does, then it will use the format. If the input does not, then it attempts to directly input the number as a BigDecimal. If that throws an InvalidArgumentException, then it will revert back to the previous value (as with current logic).
Added two unit tests to validate the up/down with currency format as well as text replacement.
(Also included with this is adding a CSS styled BigDecimalField to the sample)