Project

General

Profile

Actions

Bug #94563

closed

Number Input Validator

Added by Lennart Suwe over 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2021-07-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Remote Sprint

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.

Actions #1

Updated by Björn Jacob over 3 years ago

  • Sprint Focus set to Remote Sprint
Actions #2

Updated by Mathias Brodala over 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.

Actions #3

Updated by Mathias Brodala over 3 years ago

  • Status changed from New to Needs Feedback
Actions #4

Updated by Lennart Suwe about 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).

Actions #5

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.

Actions

Also available in: Atom PDF