Question T11649
Visible to All Users

Why does Answer JSON not contain default color hex?

created 2 years ago

I have a single input question of type Color.
The default for this is Black (when not set explicitly).
When I answer this form and choose not to change the default answer and then submit, the answer JSON does not even contain this question or its default answer (which is black). Why? Is this a bug?

Answers approved by surveyjs Support

created 2 years ago

Hello,
Here is the working example. Please fork and then modify it to reproduce the issue.

Thank you,
Andrew
SurveyJS Team

    Comments (2)
    A A
    ArchanaKrishnan 2 years ago

      Please see the forked illustration here. The Answer JSON does not contain Color question  - https://plnkr.co/edit/ZTjKjdKeohdfop5K

      In the plunkr you sent, there is just the color question and when I complete the survey, the Color question is saved in the answer JSON.

        Hello Archana,
        I tried your example. If you open the color picker and set the black color or set the "defaultValue": "#00000" then the black color value will be in the log.
        If you do not set the default value and do not choose a color then the value will not be in the log.
        It is the correct behavior.
        The problem, that html element should show a color by default when the value is undefined. Here is the html example. If you need to be sure that the color is set, then you can make your question required.

        Thank you,
        Andrew
        SurveyJS Team