survey-creator icon indicating copy to clipboard operation
survey-creator copied to clipboard

[Knockout] A Text field receives an unexpected value after changing the input type

Open JaneSjs opened this issue 1 year ago • 2 comments

T18022 - Value not reset on change from text->color->text https://surveyjs.answerdesk.io/internal/ticket/details/T18022


Please follow these steps to reproduce the issue: Change the input type from Text to Color and then back to Text. The #000000 value appears:

https://github.com/surveyjs/survey-creator/assets/22372972/bda55508-bcbd-4be7-a8c6-89eb0e4854ca

JaneSjs avatar May 03 '24 17:05 JaneSjs

The problem is in knockout. question.koValue() returns an empty array and changing question.koValue() does't seems to change anything. The input continiues to show empty color value.

andrewtelnov avatar May 04 '24 08:05 andrewtelnov

This is the default behavior for an input element. If you change the input type from color to text, the "#000000" color value is a valid string and it will be preserved as an input element value. It seems like framevorks like react, angular and others update value from a virtual dom, but knockoutjs doesn't do it. We plan to get rid of survey-knockout in V2. On the other hand, this issue doesn't seem critical. That's why we won't fix it right now. I marked it as a known issue. We will keep it open.

tsv2013 avatar May 07 '24 09:05 tsv2013