Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Selecting radio buttons using JavaScript

Selecting radio buttons using JavaScript 2 years 5 months ago #105735

  • LSCitizen
  • LSCitizen's Avatar
  • Offline
  • Junior Lime
  • Posts: 38
  • Thank you received: 1
  • Karma: 1
Hello,
I am using a List (Radio) question within a survey. I would like to use the value stored in the token table to select the corect radio button. For example, if the TOKEN:ATTRIBUTE_1 == "1", then I would like for a radio button with code value of 1 to be selected.
The administrator has disabled public write access.

Selecting radio buttons using JavaScript 2 years 5 months ago #105744

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6140
  • Thank you received: 1363
  • Karma: 535
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

Selecting radio buttons using JavaScript 2 years 5 months ago #105754

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9293
  • Thank you received: 1327
  • Karma: 384
ALtrenative solution without javascript.

Use an Equation question type / hidden in the same group (just before). With: (supposing question code is QQ and ATTRIBUTE is exactly the answer code).
{QQ=if(!is_empty(QQ),QQ,TOKEN:ATTRIBUTE_1)}
Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?).
A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous
The administrator has disabled public write access.

Selecting radio buttons using JavaScript 2 years 5 months ago #105769

  • LSCitizen
  • LSCitizen's Avatar
  • Offline
  • Junior Lime
  • Posts: 38
  • Thank you received: 1
  • Karma: 1
Thanks for your help!
Both solutions work great! :)
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.240 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form