Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: insert game (code) from URL before questions appear

insert game (code) from URL before questions appear 6 months 2 weeks ago #103165

  • baszek
  • baszek's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
Hello
I have such a game enterid001.nazwa.pl/cyberball/index.html?mode=INC and I would like to know is it possible to insert some way this game before questions appear (in the middle of a test).

I was trying to put this page in a iframe but it's not working - page appear but when you press play (in my language"GRAJ") it shows only blank page. Maybe be it's some security issue with iframe and my link which contains java script. You can see result here --> barbazylia.com/ankieta/enterid001.nazwa.pl/cyberball/test1.html

Anyway If iframe is not working, I wonder is it possible to copy code from enterid001.nazwa.pl/cyberball/index.html?mode=INC stright to lime survey and then add some code when then game is over to show next questions ? I saw that there is some option to hide question, so if it will be posible to copy game code, I may add some code to show previosly hidden question.
The administrator has disabled public write access.

insert game (code) from URL before questions appear 6 months 2 weeks ago #103205

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4062
  • Thank you received: 742
  • Karma: 341
I'm not sure what the game is supposed to do but when loaded in the iframe it creates a JavaScript error:
Capture_2014-01-07.PNG


If the game is controlled with JavaScript, you can place it's code and script in a text display question in it's own group. When the game is over, just submit that group:
document.limesurvey.move.value = 'movenext';
document.limesurvey.submit();

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

insert game (code) from URL before questions appear 6 months 2 weeks ago #103224

  • baszek
  • baszek's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
I have already manage to make my game working with survey in iframe, but going to next queastion groupe from code is not working.

Sth with your code, which you gave me is probably wrong. I have created test survey with a first groupe question with a code:
<script>
document.limesurvey.move.value = 'movenext';
document.limesurvey.submit();
</script>
and after that groupe, there is one more question groupe with one question. As you can see at my link, survey just show some "survey list" and next question groupe does not appear.
LINK to test survey: barbazylia.com/ankieta/index.php/533859/lang-en

I have also problem with disable / hide next button - It should be hidden till the game ends.
I have found such a code but it does not work at my survey too:
<script type='text/javascript'>
$(document).ready(function() {
   /* Hi There */
   /* Changing button text */
   $("table.navigator-table").hide();
});
</script>
Last Edit: 6 months 2 weeks ago by baszek.
The administrator has disabled public write access.

insert game (code) from URL before questions appear 6 months 2 weeks ago #103225

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4062
  • Thank you received: 742
  • Karma: 341
Sth with your code, which you gave me is probably wrong
This code is not wrong, it is just used incorrectly. It simply moves to the next survey page so should only be fired when the game is finished and only be used if there are following survey pages (groups).

Note that if you are running the game in an iframe you will need to apply the "submit" code to the top frame. So, if fired from within the iframe, something like this:
window.parent.document.limesurvey.move.value = 'movenext';
window.parent.document.limesurvey.submit();
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.

insert game (code) from URL before questions appear 6 months 2 weeks ago #103226

  • baszek
  • baszek's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
But I have made test survey only with that code (without iframe and game):
<script>
document.limesurvey.move.value = 'movenext';
document.limesurvey.submit();
</script>
So there is first question group with that code and after that there is second question group with a one queastion.
You can see it at barbazylia.com/ankieta/index.php/533859/lang-en
As you can see it does not show that second groupe (following).

By they way in my survey with a game I am using "movenext" code localy not from iframe. Javascript send message from iframe and survey is receving. If survey recevied massage its doing above code to go to next page.
Last Edit: 6 months 2 weeks ago by baszek.
The administrator has disabled public write access.

insert game (code) from URL before questions appear 6 months 2 weeks ago #103230

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4062
  • Thank you received: 742
  • Karma: 341
Don't fire the code until the entire document is loaded:
<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function(){
 
		document.limesurvey.move.value = 'movenext';
		document.limesurvey.submit();
 
	});
</script>
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.

insert game (code) from URL before questions appear 6 months 2 weeks ago #103231

  • baszek
  • baszek's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
I have used now your code and it worked some how once, but now every time I open my survey its refreshing constantly and It's still not going to next question.
Look barbazylia.com/ankieta/index.php/533859/lang-en
Last Edit: 6 months 2 weeks ago by baszek. Reason: now not know
The administrator has disabled public write access.

insert game (code) from URL before questions appear 6 months 2 weeks ago #103239

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4062
  • Thank you received: 742
  • Karma: 341
Here is a sample survey with a button in a text-display question in the first group that uses that code to advance to the next group.

File Attachment:

File Name: limesurvey_survey_424557.lss
File Size: 14 KB
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.

insert game (code) from URL before questions appear 6 months 2 weeks ago #103241

  • baszek
  • baszek's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 11
  • Karma: 0
tpartner wrote:
Here is a sample survey with a button in a text-display question in the first group that uses that code to advance to the next group.

File Attachment:

File Name: limesurvey_survey_424557.lss
File Size: 14 KB
I have imported your survey and it's still not working - but I have saw that its not working only at my server because I have made the same thing at your Stable v2.00+ Demo - and it was working ! The same code from my server !

I HAVE A SOLUTION - I DID not turn off XSS filter !
Last Edit: 6 months 2 weeks ago by baszek. Reason: I have a solution
The administrator has disabled public write access.

insert game (code) from URL before questions appear 6 months 2 weeks ago #103242

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4062
  • Thank you received: 742
  • Karma: 341
Ah, my code is for 2.0. In 2.05, you can use something like this:
<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
		$('#movenextbtn').click();
	});
</script>

Here is a survey you can try in 2.05:

File Attachment:

File Name: limesurvey_survey_376655.lss
File Size: 14 KB
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.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.281 seconds
Donation Image