Bug #94563
closedNumber Input Validator
0%
Description
The default validator for a number input field does not check if the value is an actual number.
Behavior:
Some browsers (eg. Firefox) allow users to enter letters in an number input field.
When the retuned form value contains letters, the whole value gets striped and no error is thrown.
If you send yourself the result in an e-mail the number input value is empty.
'65' -> '65'
'45g' -> '' and no error
Expected behavior:
If the number input value does not contain a valid number the validator should throw it's errormessage.
Updated by Mathias Brodala about 3 years ago
Can you add more details how to reproduce this? I just created a basic form definition with a Number field:
renderingOptions:
submitButtonLabel: Submit
type: Form
identifier: forge94563
label: 'Forge #94563'
prototypeName: standard
renderables:
-
renderingOptions:
previousButtonLabel: 'Previous step'
nextButtonLabel: 'Next step'
type: Page
identifier: page-1
label: Step
renderables:
-
defaultValue: ''
properties:
fluidAdditionalAttributes:
step: 1
validators:
-
identifier: Number
type: Number
identifier: number-1
label: Number
Then I manipulated the input type
to text
in the DOM inspector and entered "45g" as value. Submitting the form then shows an You must enter a valid number. error as expected.
Updated by Mathias Brodala about 3 years ago
- Status changed from New to Needs Feedback
Updated by Lennart Suwe almost 3 years ago
After changing the input type to text in the DOM, the validator is working correctly.
I also tried your way and it seems to work fine.
But if you send the value "45g" in an input of type number, the errormessage is not appeing.
You can reproduce it with Firefox. I am able to enter letters in numberfields in Firefox (version 90.0 on Linux Mint).
Updated by Björn Jacob over 2 years ago
- Status changed from Needs Feedback to Closed
We have tested the problem again on the mentioned system. We cannot reproduce the problem. Therefore, I am closing the issue. If you do not agree, please create a new issue and provide detailed information.