randomize frames

More
3 years 1 month ago #111749 by fabiu
fabiu created the topic: randomize frames
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!

Please Log in to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #111753 by Mazi
Mazi replied the topic: randomize frames
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: 3 years 1 month ago by Mazi.

Please Log in to join the conversation.

More
3 years 1 month ago #111757 by tpartner
tpartner replied the topic: randomize frames
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.

Please Log in to join the conversation.

More
3 years 1 month ago #111777 by fabiu
fabiu replied the topic: randomize frames
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?

Please Log in to join the conversation.

More
3 years 1 month ago #111783 by tpartner
tpartner replied the topic: randomize frames
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.

Please Log in to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #111797 by fabiu
fabiu replied the topic: randomize frames
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: 3 years 1 month ago by fabiu.

Please Log in to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #111798 by tpartner
tpartner replied the topic: randomize frames
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: 3 years 1 month ago by tpartner.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now