Welcome, Guest
Username: Password: Remember me

TOPIC: Collision between dynamically generated input element IDs?

Collision between dynamically generated input element IDs? 6 months 2 weeks ago #107078

  • mmatos
  • mmatos's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 1
  • Karma: 0
Hi guys. It's kind of a weird issue so I'll try to summarize as best as I can. A developer on my team ran in to a very strange issue where he was having trouble updating the value of a text element. After looking at it for a few, we discovered that there's a scenario where the dynamically generated element IDs can collide.

Background/Assumptions:

Scenario 0: When LS creates an input element, it does so in the following format.
Element ID = #answer[surveyID]X[GroupID]X[QuestionNumber]

Scenario 1: Furthermore, when this input element is of type radio button list, the answer elements are created as:
Element ID = #answer[surveyID]X[GroupID]X[QuestionNumber][AnswerNumber]

Scenario 2: When this input element is in a group, the answer elements are created as:
Element ID = #answer[surveyID]X[GroupID]X[QuestionNumber][QuestionInGroup]

So, assuming we have a radio button list question, the IDs would be something like:

#answer999999X1X51 for the first answer radio button id
#answer999999X1X52 for the second answer radio button id
and so on.

Now...on the same page we have a group of questions that has repeated 5 times. You might see where I'm going with this. We have a page with Scenario 1 and Scenario 2 happening together.

When each of the answer elements are generated in this 5th group, the IDs for the input elements are generated as such:

#answer999999X1X51
#answer999999X1X52
and so on.

So basically now the element ID has collided due to this situation. I was able to get my developer around this by specifying a more specific element id (including a class and input type in his selector) but what I don't know yet is whether this affects the collection of responses. I'm new to LS so I just haven't gotten there yet, but I wanted to post about this in case it was a bug that needed to be addressed or someone had some advice/thoughts on how to best avoid this situation.

Your thoughts appreciated!
The administrator has disabled public write access.

Collision between dynamically generated input element IDs? 6 months 2 weeks ago #107086

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6435
  • Thank you received: 840
  • Karma: 249
Hi,

I allways use alphabetic character for answer code and sub question code , then: no collision.

But i think we have a system to fix numbering when activate a survey, did you test to activate and deactivate and see if the question id was updated ?

Denis
PS: you can put a bug report, but i think it's a 'wont fix'
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.095 seconds
Donation Image