Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Insert a new answer via javascript

  • mpac_limes
  • mpac_limes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago #183982 by mpac_limes
Insert a new answer via javascript was created by mpac_limes
I'm trying to insert a whole set of answers via javascript but they seem to fail validation when one of them is the selected option.

I've already seen THIS POST but either it doesn't work for me or I don't understand what I'm supposed to do. I think this same thing was a breeze to do in earlier versions of LS :(

By the way, text label and value are equally important for the purpose of the question.

I've attached a sample survey, but the point is in adding a new option via javascript and to get LS accept it as a valid answer


Thanks
The topic has been locked.
  • mpac_limes
  • mpac_limes's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 11 months ago #184042 by mpac_limes
Replied by mpac_limes on topic Insert a new answer via javascript
Let me reformulate the question:

What do I have to do after my javascript code has inserted a new answer option in a single choice question (dropdown) for Limesurvey to accept it as a valid one when chosen by the user.

If I insert it and then do nothing, when it is chosen it fails validation and the form won't allow to advance to the next sections.

Any help would be appreciated.

Thanks
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 11 months ago - 4 years 11 months ago #184047 by tpartner
Replied by tpartner on topic Insert a new answer via javascript
It look like a validation was introduced a couple of years ago - github.com/LimeSurvey/LimeSurvey/commit/...a9d461e4ea80c9R10257

A possible workaround may be to use a short-text question and build a complete drop-down to load it with JavaScript.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 11 months ago by tpartner.
The following user(s) said Thank You: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose