Float type validateValue not check not a number.
See original GitHub issueOpenUI5 version: 1.50
URL (minimal example if possible): http://plnkr.co/edit/ahS6NlUHHL0kdvdddvgd?p=preview
Steps to reproduce the problem:
- Input --0.1
-
What is the expected result? Remove focus, error message will show in input, validateValue should throw an error
-
What happens instead? validateValue did not throw an error. Instead, in
onContinue
,oBinding.getType().validateValue(oInput.getValue())
returnedundefined
, it should not pass validate. But if I input200
,oBinding.getType().validateValue(oInput.getValue())
will throw an error
In Float.prototype.validateValue
, there seems not check for isNumber
: https://github.com/SAP/openui5/blob/3a212d2b66e7935986b5507c5f520c99ec645497/src/sap.ui.core/src/sap/ui/model/type/Float.js#L87
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How do I check that a number is float or integer?
Here are efficient functions that check if the value is a number or can be safely converted to a number: function isNumber(value) {...
Read more >Custom Data Types in SAPUI5 - SAP Blogs
For validating whether we're dealing with a valid credit card number or not, we will implement the Luhn's algorithm in our validateValue method....
Read more >qcodes.validators — QCoDeS 0.37.0.dev48 documentation
Validator for numerical numpy arrays of numeric types (int, float, complex). ... Min value allowed, default None for which min value check is...
Read more >Validate Integer and Decimal Values in SQL Server
Learn how to validate specific use cases for integer and decimal values in SQL Server.
Read more >Valdi — Valdi v0.3.0 - HexDocs
iex> Valdi.validate(10, type: :integer, number: [min: 10, max: 20]) :ok iex> ... validate(value, validators) ... Validate value if value is not nil.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello TinaC,
works as expected. validateValue is meant to validate the constraints on float values, it doesn’t need to be able to handle strings. When entering a string which does not represent a valid float number parseValue will throw an error.
So whenever a value is entered, first parseValue is called to convert the string value into a number. Only if parsing was successful, validateValue will be called with the result.
Regards, Malte
Hi Malte,
I just make some changes to official custom input type: https://sapui5.hana.ondemand.com/#/sample/sap.m.sample.InputChecked/preview
validateValue
is used to make my custom validate rule for this type.I did not use
parseValue
, just add it in case there is an error forparseValue not found
.So here comes to my question: ui5 just check the float value is within boundary conditions, but missing the check for the value is a float/number
Regards, Tina