Hi,
Why does dynamic panels require unique names?
In some cases it seems way easier to handle panel differences with another panel with the same name instead of many rules within the same panel. Would also allow them to appear in different places.
Wouldn't the output be the same anyway? Just another array?
In attached json use-case is for "tpVariable" which is temporarily fixed by adding a number to the next panel "tpVariable2" (etc.), but we actually want it to appear in "tpVariable" (remove number) in backend.
Also we get an error message in editor which was not present when we made them in design-mode:
Regards
Mad (not mad, just a nick)
Hello,
Thank you for contacting us.
An array of survey results (user responses) uses question or value names as keys:
{ "question1Name": "question1Value", "question2Name": "question2Value", // ... "questionNName": "questionNValue", }
A survey form uses question (and panel) names to identify values within the survey results array. Therefore, question names must be unique. If multiple dynamic panels have the same
name
and contain fields named identically, a form will duplicate values within panel fields.Please consider the following demo:
{ "logoPosition": "right", "pages": [ { "name": "page1", "elements": [ { "type": "paneldynamic", "name": "testPanel", "templateElements": [ { "type": "text", "name": "userName" } ] }, { "type": "paneldynamic", "name": "testPanel", "startWithNewLine": false, "templateElements": [ { "type": "text", "name": "userName" } ] } ] } ] }
A
survey.data
value stores a single entry because question and field names are identical:{ "testPanel": [ { "userName": "Nick" } ] }
Would you elaborate your requirement? Do you wish to create multiple dynamic panels which share values? Or, should they have identical names but unique values?
Your example would fill my requirement if it worked/was supposed to work? I get error message when entering this in form editor:
We would like to be able to do this, and handle output by show/hide rules.
Lets say i want to show your left panel in one scenario and right panel for another scenario. I understand it can by done by show/hide rules on and within the panel, but when things get complex it seems easier to duplicate panel with the same name and content, but different show/hide scenarios.
Hi Mad,
Thank you for the update. The example I provided illustrates an issue with the survey structure that should not be configured this way. In this example, I demonstrated that when you assign identical names to both panels and inner fields, it results in the duplication of values. This behavior is problematic because, in a typical scenario, user-entered values will be overwritten by newly entered ones. Consequently, regardless of whether you choose to show or hide panels, if panels and their fields have the same names, the values entered later will override those entered earlier. I believe this outcome is not the expected behavior.
I'd like to explore a simplified case that aligns more closely with your real-life scenario. I'd like to consider alternative options.
Could you please share a demo that illustrates a potential configuration and provides an example of how you intend to show/hide a panel?