- Posts: 7
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8"> function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } $(document).on('ready pjax:scriptcomplete',function(){ // Fill the array with your prices var arr = ["1.00", "1.10", "1.20", "1.30", "1.40", "1.50", "1.60", "1.70", "1.80", "1.90", "2.00"]; // Shuffle the array arr = shuffle(arr); // Pick only the first element of the array anumbers = arr.slice(0,1).join(''); // Fill the question with this element $('#question{QID} input[type="text"]').val(anumbers); // After testing hide the question by removing the slashes of the next line // $('#question{QID}').hide(); }); </script>
Okay, that's easy. Random number and display of the text - either with four questions and relevance equation or by tayloring the text (depends a bit of the text)Info at the start is different depening on condition
andfollowing are 4 question groups which are the same
Which 4 question groups? Do you have a question group for each condition? Why, if they are the same?I need the order of the questions to be differnt
Please Log in to join the conversation.
Please Log in to join the conversation.
But this is a question of type "short text" and you fill the answer field with the value. So it is stored.In the first question group "Condition" I have managed to use Javascript to randomly display 1 of 4 images which determines the condition (treatment group) of the participant. The issue here is that I cannot get a hidden variable displaying the condition number.
No, as you named the images according to the random number this is sufficient, use ExpressionScript.I guess an alternative would be to use a similar code to what you mentioned before with the nested if statements, but could I do this with displaying images?
<img src="/lime3/upload/surveys/{SID}/files/pic/{randImg}.jpg" style="width: 792px; height: 446px;" />
Put it into the group description!Cherry on top would be to have the image "frozen" at the start of each page (question group).
Setting in "Presentation"Can I also hide the title of each of the question groups?
What type of question?Lastly, how can I insert a dollar sign in the answer field? So that subjects see answer field with dollar sign and they simply insert a number.
Please Log in to join the conversation.
Please Log in to join the conversation.
{if(rand1==1,"€ 1.00", if(rand1==2,"€ 1.21", ...
{if(rand1==1,"<img src='/upload/survey/.../imageXYZ.jpg' />", if(rand1==2,"<img src='...
{if(rand1==1,"ImageABC.jpg", if(rand1==2,"Picture XYZ.png", if(rand1==3,"TheNewImage.jpg",...
<img src="/lime3/upload/surveys/{SID}/files/pic/{MyImage}" style="whatever you want to style;" />
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
<div style="position: relative; width: 100%; height: 0; padding-top: 56.2500%; padding-bottom: 0; box-shadow: 0 2px 8px 0 rgba(63,69,81,0.16); margin-top: 1.6em; margin-bottom: 0.9em; overflow: hidden; border-radius: 8px; will-change: transform;"> <iframe allow="fullscreen" allowfullscreen="allowfullscreen" loading="lazy" src="https://www.canva.com/design/{QImage}/view?embed" style="position: absolute; width: 100%; height: 100%; top: 0; left: 0; border: none; padding: 0;margin: 0;"> </iframe> </div> <a href="https://www.canva.com/design/{QImage}/view?utm_content={QImage}&amp;utm_campaign=designshare&amp;utm_medium=embeds&amp;utm_source=link" rel="noopener" target="_blank">SOC by Carmen Campagnolo</a>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.