Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: randomize frames

randomize frames 2 years 3 months 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 2 years 3 months ago #111753

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6027
  • Thank you received: 373
  • Karma: 260
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)survey-consulting.com'"
Last Edit: 2 years 3 months ago by Mazi.
The administrator has disabled public write access.

randomize frames 2 years 3 months ago #111757

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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.
The administrator has disabled public write access.

randomize frames 2 years 3 months 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 2 years 3 months ago #111783

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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.
The administrator has disabled public write access.

randomize frames 2 years 3 months 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: 2 years 3 months ago by fabiu.
The administrator has disabled public write access.

randomize frames 2 years 3 months ago #111798

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6566
  • Thank you received: 1477
  • Karma: 578
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.
Last Edit: 2 years 3 months ago by tpartner.
The administrator has disabled public write access.
Time to create page: 0.444 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form