Welcome, Guest
Username: Password: Remember me

TOPIC: Selecting radio buttons using JavaScript

Selecting radio buttons using JavaScript 5 months 4 days ago #105735

  • LSCitizen
  • LSCitizen's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 33
  • Karma: 0
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 5 months 3 days ago #105744

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4071
  • Thank you received: 748
  • Karma: 341
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 5 months 3 days ago #105754

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6236
  • Thank you received: 794
  • Karma: 238
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 5 months 3 days ago #105769

  • LSCitizen
  • LSCitizen's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 33
  • Karma: 0
Thanks for your help!
Both solutions work great! :)
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.155 seconds
Donation Image