Reputation: 1
when using Surveyjs creator, I often do some very basic maths operations with answers values. For example, if questions have 4 different answer options, I set their values to (1,2,3,4), regardless of their labels (what appears to the user). Then I insert a read-only expression at the very end of the survey in which I calculate and display the total sum of all the answers (e.g. "Your score is 28").
This actually works fine, but now I was asked to insert questions that have the same value for multiple answer options (e.g. 0,0,1,1). If I try to do it in the editor, I receive a "Please enter a unique value" error message (see picture 1 error message). I can force it by editing the json, but then I get a weird visualisation as if both options were selected (see picture 2 weird visualisation)
For the time being, I just merged, and thus reduced, the answers into one with a unique value (from 4 to 2 answers: "Option A or Option B" with value 0 and "Option C and Option D" with value 1) but this is not nice because the text might be very long and the client actually wants to know which answer was selected regardless their value.
So, is there a good way to solve this?
PS: I can't write code since I'm the forms/surveys guy.
Upvotes: 0
Views: 174
Reputation: 196
The value in choices should be unique, otherwise radigroup/checkbox/dropdown may not functional correctly. You can of course remove the check on unique value, since it is set on a property level:
Survey.Serializer.findProperty("itemvalue", "value").isUnique = false;
SurveyJS Team
Upvotes: 0