Welcome, Guest
Username: Password: Remember me

TOPIC: Selecting radio buttons using JavaScript

Selecting radio buttons using JavaScript 1 year 6 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 1 year 6 months ago #105744

  • tpartner
  • tpartner's Avatar
  • Online
  • LimeSurvey Team
  • Posts: 5107
  • Thank you received: 1049
  • Karma: 440
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Selecting radio buttons using JavaScript 1 year 6 months ago #105754

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 7510
  • Thank you received: 1024
  • Karma: 297
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)}
The administrator has disabled public write access.

Selecting radio buttons using JavaScript 1 year 6 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.144 seconds