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 9 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 9 months ago #105744

  • tpartner
  • tpartner's Avatar
  • Online
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
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 9 months ago #105754

  • DenisChenu
  • DenisChenu's Avatar
  • Online
  • Moderator Lime
  • Posts: 9596
  • Thank you received: 1376
  • Karma: 390
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 development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (use private message).
The administrator has disabled public write access.

Selecting radio buttons using JavaScript 2 years 9 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.
Time to create page: 0.215 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form