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

When survey.data contains a number as a string, and an expression returns the same value as a number, survey response stays the same #9690

Closed
JaneSjs opened this issue Apr 4, 2025 · 0 comments · Fixed by #9693
Assignees
Labels
user issue An issue or bug reported by users

Comments

@JaneSjs
Copy link
Contributor

JaneSjs commented Apr 4, 2025

T22451 - expression calculated at loading time but does not change the survey data
https://surveyjs.answerdesk.io/internal/ticket/details/T22451


View Demo

Usage scenario: an expression field is calculated using a custom function. The custom function produces a numeric result (e.g., 2).
A survey.data is set to some response. The response contains a value for the expression field. The value is a string ("2").
The issue: a form library uses the Helpers.isTwoValueEquals function to check if these two values (2 and "2") are equal. These values are considered equal and the expression field's value is not updated to use the custom function result (2). Instead, the expression field persists the value specified via survey.data ("2").

Suggestion: introduce an option which would additionally check a value type. If types are different, update a question value and use the custom function result.

@JaneSjs JaneSjs added the user issue An issue or bug reported by users label Apr 4, 2025
@andrewtelnov andrewtelnov changed the title When survey.data contains a number in a string format ("2"), a custom function result (a number) is not saved to a survey response When survey.data contains a number in a string format and expression returns the same value as a number then survey response is not changed Apr 4, 2025
andrewtelnov added a commit that referenced this issue Apr 4, 2025
…returns the same value as a number then survey response is not changed fix #9690
@tsv2013 tsv2013 closed this as completed in ed6f9f1 Apr 8, 2025
@RomanTsukanov RomanTsukanov changed the title When survey.data contains a number in a string format and expression returns the same value as a number then survey response is not changed When survey.data contains a number as a string, and an expression returns the same value as a number, survey response stays the same Apr 8, 2025
andrewtelnov added a commit that referenced this issue Apr 8, 2025
#9693)

* When survey.data contains a number in a string format and expression returns the same value as a number then survey response is not changed fix #9690

* FIx functional test for custom widget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user issue An issue or bug reported by users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants