- Posts: 9
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
insert game (code) from URL before questions appear
- baszek
- Topic Author
- Offline
- New Member
Less
More
10 years 2 months ago #103165
by baszek
insert game (code) from URL before questions appear was created by baszek
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.
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 topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 2 months ago #103205
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic 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:
.
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:
Code:
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.
Attachments:
The topic has been locked.
- baszek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
10 years 2 months ago - 10 years 2 months ago #103224
by baszek
Replied by baszek on topic 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:
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:
Sth with your code, which you gave me is probably wrong. I have created test survey with a first groupe question with a code:
Code:
<script> document.limesurvey.move.value = 'movenext'; document.limesurvey.submit(); </script>
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:
Code:
<script type='text/javascript'> $(document).ready(function() { /* Hi There */ /* Changing button text */ $("table.navigator-table").hide(); }); </script>
Last edit: 10 years 2 months ago by baszek.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 2 months ago #103225
by tpartner
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:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic insert game (code) from URL before questions appear
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).Sth with your code, which you gave me is probably wrong
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:
Code:
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.
The topic has been locked.
- baszek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
10 years 2 months ago - 10 years 2 months ago #103226
by baszek
Replied by baszek on topic insert game (code) from URL before questions appear
But I have made test survey only with that code (without iframe and game):
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.
Code:
<script> document.limesurvey.move.value = 'movenext'; document.limesurvey.submit(); </script>
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: 10 years 2 months ago by baszek.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 2 months ago #103230
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic insert game (code) from URL before questions appear
Don't fire the code until the entire document is loaded:
Code:
<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.
The topic has been locked.
- baszek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
10 years 2 months ago - 10 years 2 months ago #103231
by baszek
Replied by baszek on topic 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
Look barbazylia.com/ankieta/index.php/533859/lang-en
Last edit: 10 years 2 months ago by baszek. Reason: now not know
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 2 months ago #103239
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic 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.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- baszek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
10 years 2 months ago - 10 years 2 months ago #103241
by baszek
I HAVE A SOLUTION - I DID not turn off XSS filter !
Replied by baszek on topic insert game (code) from URL before questions appear
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 !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.
I HAVE A SOLUTION - I DID not turn off XSS filter !
Last edit: 10 years 2 months ago by baszek. Reason: I have a solution
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
10 years 2 months ago #103242
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic insert game (code) from URL before questions appear
Ah, my code is for 2.0. In 2.05, you can use something like this:
Here is a survey you can try in 2.05:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#movenextbtn').click(); }); </script>
Here is a survey you can try in 2.05:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- baszek
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
10 years 2 months ago - 10 years 2 months ago #103244
by baszek
Replied by baszek on topic insert game (code) from URL before questions appear
This code works perfect! Thx a lot !tpartner wrote: Ah, my code is for 2.0. In 2.05, you can use something like this:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function() { $('#movenextbtn').click(); }); </script>
Here is a survey you can try in 2.05:
Last edit: 10 years 2 months ago by baszek. Reason: some changes
The topic has been locked.
- tomscher
- Offline
- New Member
Less
More
- Posts: 6
- Thank you received: 0
9 years 4 months ago #114282
by tomscher
Replied by tomscher on topic 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?
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?
The topic has been locked.