Welcome, Guest
Username: Password: Remember me

TOPIC: randomize frames

randomize frames 1 month 3 days ago #111749

  • fabiu
  • fabiu's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
Hey guys,

in my survey I compare 2 homepages. I'd like to put them in my survey with a iframe and then randomize them - so the user either gets to see homepage/ frame A oder homepage/ frame B. Is this possible and if so, how?

thanks!
The administrator has disabled public write access.

randomize frames 1 month 3 days ago #111753

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
If you embed the frame as answer option e.g. at a list radio question, you can set to randomly list the options. This can be set at the advanced question settings: manual.limesurvey.org/QS:Random_order

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
Last Edit: 1 month 3 days ago by Mazi.
The administrator has disabled public write access.

randomize frames 1 month 3 days ago #111757

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4194
  • Thank you received: 789
  • Karma: 359
I would put the iframes in separate text-display questions and control their visibility via relevance based on a random number in a hidden equation question.
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.

randomize frames 1 month 2 days ago #111777

  • fabiu
  • fabiu's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
So I tried to figure out an equation but none will work. The frames work perfectly fine, but they're just listed below each other. What is the equation supposed to look like?
The administrator has disabled public write access.

randomize frames 1 month 2 days ago #111783

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4194
  • Thank you received: 789
  • Karma: 359
Assuming that your equation question precedes the text-display questions and has a code "random1", the equation in "random1" should be:
if(random1 > 0, random1 , rand(1, 1))

The relevance for the first text-display:
random1 == '1'

The relevance for the second text-display:
random1 == '2'


.
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.

randomize frames 1 month 1 day ago #111797

  • fabiu
  • fabiu's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 4
  • Karma: 0
ok so I found the code
{rand(1,2)}
and it worked perfectly fine - it showed either 1 or 2.

So I thought I could just put my frames in here instead of the 1 and the 2:
{rand(
('<iframe src="https://epetitionen.bundestag.de/" width="1000" height="600" ></iframe>'),
('<iframe src="https://www.uni-wuerzburg.de/" width="1000" height="600"></iframe>')
)}

all I see is an empty box, but I dont get any error messages. Is there an error in my code, which I just don't see?
Last Edit: 1 month 1 day ago by fabiu.
The administrator has disabled public write access.

randomize frames 1 month 1 day ago #111798

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4194
  • Thank you received: 789
  • Karma: 359
That will not work, rand() is a PHP function. Please read the manual - manual.limesurvey.org/Expression_Manager#Access_to_Functions
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.
Last Edit: 1 month 1 day ago by tpartner.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.358 seconds
Donation Image