insert game (code) from URL before questions appear

Plus d'informations
il y a 3 ans 10 mois #103165 par baszek
baszek a créé le sujet : insert game (code) from URL before questions appear
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.

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois #103205 par tpartner
tpartner a répondu au sujet : insert game (code) from URL before questions appear
I'm not sure what the game is supposed to do but when loaded in the iframe it creates a JavaScript error:


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.
Pièces jointes :

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois - il y a 3 ans 10 mois #103224 par baszek
baszek a répondu au sujet : insert game (code) from URL before questions appear
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>
Dernière édition: il y a 3 ans 10 mois par baszek.

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois #103225 par tpartner
tpartner a répondu au sujet : insert game (code) from URL before questions appear

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.

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois - il y a 3 ans 10 mois #103226 par baszek
baszek a répondu au sujet : insert game (code) from URL before questions appear
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.
Dernière édition: il y a 3 ans 10 mois par baszek.

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois #103230 par tpartner
tpartner a répondu au sujet : insert game (code) from URL before questions appear
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.

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois - il y a 3 ans 10 mois #103231 par baszek
baszek a répondu au sujet : insert game (code) from URL before questions appear
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
Dernière édition: il y a 3 ans 10 mois par baszek. Raison: now not know

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois #103239 par tpartner
tpartner a répondu au sujet : insert game (code) from URL before questions appear
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.

Fichier attaché :

Nom du fichier : limesurvey...4557.lss
Taille du ficher :14 ko

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Pièces jointes :

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois - il y a 3 ans 10 mois #103241 par baszek
baszek a répondu au sujet : insert game (code) from URL before questions appear

tpartner écrit: 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.

Fichier attaché :

Nom du fichier : limesurvey...4557.lss
Taille du ficher :14 ko

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 !
Dernière édition: il y a 3 ans 10 mois par baszek. Raison: I have a solution

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois #103242 par tpartner
tpartner a répondu au sujet : insert game (code) from URL before questions appear
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:

Fichier attaché :

Nom du fichier : limesurvey...6655.lss
Taille du ficher :14 ko

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Pièces jointes :

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 10 mois - il y a 3 ans 10 mois #103244 par baszek
baszek a répondu au sujet : insert game (code) from URL before questions appear

tpartner écrit: 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:

Fichier attaché :

Nom du fichier : limesurvey...6655.lss
Taille du ficher :14 ko

This code works perfect! Thx a lot !
Dernière édition: il y a 3 ans 10 mois par baszek. Raison: some changes

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 1 semaine #114282 par tomscher
tomscher a répondu au sujet : insert game (code) from URL before questions appear
Sorry for bumping up that old thread, but I have a similar problem:
I embed an external game in Limesurvey which should trigger the 'submit' function at the end. For that purpose, I do the following:

a) embed the game using iframe (no probs here)
b) hide the 'next' button of LS to avoid premature submissions (no probs here)
c) at the end of the game, I want to submit the LS-question group and go to the next question group (problem is here).

I have tried the following JS lines at the appropriate places (i.e. within a function that is called at the end of the game within the frame):

document.limesurvey.move.value = 'movenext';
document.limesurvey.submit();

Also not working: defining a function with the proposed "click"-Code from below in LS and calling this function (nextLSpage) from the frame using window.opener.nextLSpage();

Possibly it's a simple solution - I am just completely stuck and help is highly appreciated.

I use LS 2.05 and my first solution did work in previous versions (up from at least 1.92) - so what would be the new equivalent to automatically submit question groups from another frame?

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 1 semaine - il y a 3 ans 1 semaine #114284 par tpartner
tpartner a répondu au sujet : insert game (code) from URL before questions appear
Try this in the iframe:

$('#movenextbtn', window.top.document).click();


This sets the scope in which to search for "#movenextbtn" to the top window.



.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Dernière édition: il y a 3 ans 1 semaine par tpartner.
Les utilisateur(s) suivant ont remercié: tomscher

Connexion pour participer à la conversation.

Plus d'informations
il y a 3 ans 1 semaine #114288 par tomscher
tomscher a répondu au sujet : insert game (code) from URL before questions appear
Thank you! Works like a charm! :)

Connexion pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!