Welcome, Guest
Username: Password: Remember me

TOPIC: Selecting radio buttons using JavaScript

Selecting radio buttons using JavaScript 7 months 4 weeks 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 7 months 4 weeks ago #105744

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
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 7 months 3 weeks ago #105754

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6451
  • Thank you received: 844
  • Karma: 249
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 7 months 3 weeks 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.160 seconds
Donation Image