Question T14314
Visible to All Users

Values are not being updated in dynamic panel

created a year ago

Clipboard-File-3.pngClipboard-File-4.pngClipboard-File-5.png

Hello team,
Currently we are facing issue where in dynamic panel after validation the value of the "selector" option (File-5) is not being updated in other selections (File-3 i have selected other option with assigned values, but value with numbers remains the same). Same goes for options where nothing is selected. Values being assigned using iif() function. Though everything works fine if "Complete" button was not pressed and no validations were made.
Could you help us resolve the issue please?

sincerely,
Erikas

Show previous comments (1)
EJ EJ
Erikas Jurgelevicius a year ago

    Good morning, I tried to make best possible example for the issue I am facing.

    1. Choose editable option first which is "Unique". (but before that check other options and see that values are being assigned)
    2. Then create an error by typing values higher than 40 or lower than 6
    3. Then choose options test1, test2 or test3 and you will see that values are not being updated.

    Thank you for your help,
    Looking forward for your response.

      Hi Erikas,
      Thank you for the update.

      The defaultValueExpression is applied unless a value is defined by a user or from code. Therefore, if you already specify a value (no matter whether it's correct or not) for the textbox entry, the value won't be updated even though you update the selected dropdown item.

      I'll consider an option to update a textbox once a user modifies the selected dropdown item. I'll update this ticket shortly.

      EJ EJ
      Erikas Jurgelevicius a year ago

        Thank you Jane, for your response. Will be waiting for further notice.

        Answers approved by surveyjs Support

        created a year ago

        Hi Erikas,
        You can programmatically update a question3 value when question1's value is changed. Please use the survey.onDynamicPanelItemValueChanged event.

        JavaScript
        survey.onDynamicPanelItemValueChanged.add((sender, options) => { if (options.name === "question2") { let question3 = options.panel.getQuestionByName("question3"); let q3Val = ""; switch (options.value) { case "test1": q3Val = 5; break; case "test2": q3Val = 10; break; case "test3": q3Val = 20; break; } question3.value = q3Val; } });

        View Demo

        I hope this example can help you. Please let me know if you have any further questions.

          Comments (2)
          EJ EJ
          Erikas Jurgelevicius a year ago

            Thank you. I will test how it works on our side and will let you know. :)

              You're welcome. Please feel free to contact us if you have any more questions.