Skip to content
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

Text input of type number should forbid invalid characters and allow decimal values #93

Closed
laogao opened this issue Jun 28, 2023 · 0 comments · Fixed by #94
Closed

Text input of type number should forbid invalid characters and allow decimal values #93

laogao opened this issue Jun 28, 2023 · 0 comments · Fixed by #94
Labels
bug Something isn't working

Comments

@laogao
Copy link
Contributor

laogao commented Jun 28, 2023

Describe the bug
Currently a text input of type number would allow characters such as a (the captured value would then become null), and at the same time double values such as 1.2 would fail the validation (with the follwing error message: {some number: {number: true}}).

To Reproduce
SurveyJs json

{
    "title": "number input issue",
    "logoPosition": "right",
    "pages": [
        {
            "name": "page1",
            "elements": [
                {
                    "type": "text",
                    "name": "some number",
                    "title": "some number",
                    "isRequired": true,
                    "inputType": "number"
                }
            ]
        }
    ],
    "showQuestionNumbers": "off"
}

SurveyJs answer

{}

Expected behavior
A text field of type number should restrict the keyboard to allow only digits and (0 or 1) decimal point(s). And decimal values (such as 1.2) shouldn't fail the number validator. This is also how the web version behaves.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome
@laogao laogao added the bug Something isn't working label Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant