surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.23k stars 816 forks source link

Do not try to convert a very large string into number #9095

Closed JaneSjs closed 1 day ago

JaneSjs commented 1 week ago

Update

Please use "expression": "{#question1}"

Explanation

This is the way the JavaScript converts 999999999999999999 to number. SurveyJS expression tries to convert the string to number, if it is possible. To avoid it, please use the following expression: "LT + {#klausimas1}"


T20834 - Pattern input mask bug https://surveyjs.answerdesk.io/internal/ticket/details/T20834


Consider the following pattern input mask:

LT99 9999 9999 9999 9999

And the following sample JSON: View Demo.

{
  "pages": [
    {
      "name": "page1",
      "elements": [
        {
          "type": "text",
          "name": "question1",
          "maskType": "pattern",
          "maskSettings": {
            "pattern": "LT99 9999 9999 9999 9999"
          }
        },
        {
          "type": "expression",
          "name": "question2",
          "expression": "{question1}"
        }
      ]
    }
  ]
}

You can see that the expression {question1} which is supposed to display a question1's value displays another value: image

OlgaLarina commented 2 days ago

This bug is reproduced without a mask if you enter a large enough numerical value - 99999999999999999.

{
    logoPosition: "right",
    pages: [
      {
        name: "puslapis1",
        elements: [
          {
            type: "text",
            name: "klausimas1",
            title: "klausimas1",
          },
          {
            type: "text",
            name: "klausimas2",
            defaultValueExpression: "{klausimas1}",
          },
        ],
      },
    ],
  }