View Issue Details

This issue affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
05324Bug reportsOtherpublic2011-07-08 17:23
ReporterTMSWhite Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionno change required 
Product Version1.91+ 
Summary05324: SGQA name clashes - multiple questions on same page can generate same SGQA name
Description

Since the SGQA naming algorithm concatenates A codes after the Q number without a separator character (like another X or an underscore), a single group can end up with two or more questions (or their answers) having the same JavaScript Name and/or ID.

I'm flagging this as severity = minor / priority = normal since I'm not seeing abnormal behavior myself. However, I expect this should really be major/high.

Steps To Reproduce

Group 3 of the attached survey shows this behavior.

Question 61764X3X9 (Type L - List Radio) - has answer codes 61764X3X91-61764X3X96.
However, this survey also has:
61764X3X91 (Type N - Numerical Input)
61764X3X93 (Type Y)
61764X3X93 (Type U)
61764X3X95 (Type T)

So, those 4 questions all have names and IDs that clash with question 9.

Additional Information

Despite the name clash, I'm not seeing any obvious errors in how the survey functions. However, I'm not trying to show/hide questions on this page, or use INSERTSGQA: to insert values. If I were doing that, I'd expect to see bizarre or inaccurate behavior.

Suggestion: Change the SQGA-generating algorithm to insert an underscore between sections. This will also make it easier to parse the SGQA code.

TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)10378
I will donate to the project if issue is resolvedNo
BrowserFirefox
Database type & versionMysql 5
Server OS (if known)Windows XP
Webserver software & version (if known)Apache 2
PHP Version5.2
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

mdekker

mdekker

2011-07-07 09:42

reporter   ~15666

Don't know why there isn't a separator for the answer. It's a pain, I know... the problem can only occur when you have the questions in the same group. So if you have qid 1 you could get qid 11 in the same group but for higher numbers it is unlikely to happen as the qid's are too far apart. that's probably why it has never been a problem.

Nameclash should occur for the survey table too as they use the same names so I guess that activating the survey would result in an error as it would try to create a table with two idential fields.

TMSWhite

TMSWhite

2011-07-07 12:19

reporter   ~15669

I did activate the survey, and no errors were thrown. Perhaps the error checking system doesn't ensure that the JavaScript answerSGQA, javaSGQA, tobedispSGQA, etc. objects will all be unique?

Also, even though this should rarely happen, it happened on the very first survey I created.

TMSWhite

TMSWhite

2011-07-07 19:22

reporter   ~15672

As you say, this may be low risk. I just re-imported that survey (so that I could change the order of questions), and since it kept incrementing the qid, I don't have the same problem with the second instance of the survey.

So, if someone's survey behaves oddly, they can export and re-import it and have the problem probably go away.

I think it would still be safer to expand the on-activate validation steps (to make sure there are no JavaScript name clashes), or provide an FAQ or other notice so people are aware of this potential issue and how to work around it.

c_schmitz

c_schmitz

2011-07-08 14:09

administrator   ~15680

Last edited: 2011-07-08 14:09

TMSWhite, on activation it is checked for duplicate fieldnames and any clashes are corrected before activation.

TMSWhite

TMSWhite

2011-07-08 15:24

reporter   ~15681

Glad to hear it.

But, does it check to ensure there won't be any clashes in the JavaScript name and id attributes (e.g. answerSGQA, tbdispSGQA, javaSGQA, javatbdSGQA, etc.)?

Also, when it corrects clashes, what are the implications for the developer? Say the author has a lot of INSERTANS:xxxx fields, or embedded JavaScript calls to ${#answerSGQA}, will those references be updated with the new fieldnames? If not, does the activation process alert the developer which fields have changed? (I didn't see any such message myself) so they can be sure to fix all of the affected fieldnames?

c_schmitz

c_schmitz

2011-07-08 16:59

administrator   ~15683

If the fieldnames don't clash, the oter things don't clash automatically.
There is no correction procedure for existing tags. Clashes are very very rare - I have seen it only a couple times during the last 6 years.
And only because the clashing correction function did not work for a couple years, but nobody really noticed.

c_schmitz

c_schmitz

2011-07-08 17:23

administrator   ~15697

Anyway, no bug here :-)
Yes, changing the naming in future version would be nice. Maybe for v 2.0.

Issue History

Date Modified Username Field Change
2011-07-07 05:22 TMSWhite New Issue
2011-07-07 05:23 TMSWhite File Added: ExpressionManager-plus-all-question-types.lss
2011-07-07 09:42 mdekker Note Added: 15666
2011-07-07 12:19 TMSWhite Note Added: 15669
2011-07-07 19:22 TMSWhite Note Added: 15672
2011-07-08 14:09 c_schmitz Note Added: 15680
2011-07-08 14:09 c_schmitz Note Edited: 15680
2011-07-08 15:24 TMSWhite Note Added: 15681
2011-07-08 16:59 c_schmitz Note Added: 15683
2011-07-08 17:23 c_schmitz Note Added: 15697
2011-07-08 17:23 c_schmitz Status new => closed
2011-07-08 17:23 c_schmitz Assigned To => c_schmitz
2011-07-08 17:23 c_schmitz Resolution open => no change required