Insert a new answer via javascript

More
1 month 2 weeks ago #183982 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
Attachments:

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
1 month 1 week ago #184042 by mpac_limes
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

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #184047 by tpartner
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.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 1 month 1 week ago by tpartner.
The following user(s) said Thank You: DenisChenu

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!