Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

"token based response persistence" doesn't remember the right page

  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago - 7 years 9 months ago #139484 by Sweden
Hi,

I use tokens for my survey (I add them to the survey URL) and "token based response persistence" is turned on. It doesn't seem to work correctly.

Let me explain: I got 4 question groups (pages) in my survey. Let's say I answer all questions on page 1,2 and 3 and then I use my survey link again (with the same token). I would assume that I would return to page 3, but I return to page 2. If I now use the link again I get to page 1! Now I don't want people to change what they already answered on page 1 and page 2, but because of this issue they now can. I need to use tokens and I do want people to be able to get back to page 3 and 4.

Shouldn't it return to the last page viewed? I don't allow people to jump back (there are no "back" buttons), but this way they can. How can I fix this?
Last edit: 7 years 9 months ago by Sweden. Reason: wrong topic icon
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #139496 by holch
It will return to the last page saved (pressed a button), because Limesurvey can't save what hasn't been submitted yet.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: Sweden
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #139502 by DenisChenu
Hi,

Maybe you can find a way to use a plugin to set the step according to some conditions. Take inspiration here : framagit.org/SondagePro-LimeSurvey-plugi...r/fixMaxStep.php#L85

If you think it's a bug and you use the last LimeSurvey version : report a bug.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: Sweden
The topic has been locked.
More
7 years 9 months ago - 7 years 9 months ago #139519 by fvanderstarre
[strike]Also, make sure your survey is non-anonymous...[/strike] Please ignore :whistle:
Last edit: 7 years 9 months ago by fvanderstarre. Reason: Incorrect
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #139541 by Sweden

holch wrote: It will return to the last page saved (pressed a button), because Limesurvey can't save what hasn't been submitted yet.


Thanks holch, but page 3 was saved (submitted) the first time. Now if I use the URL again it takes me to page 3 - this means that if I use the URL again without saving it takes me to page 2 (because page 3 wasn't saved this time). I think it shouldn't overwrite what already has been saved when nothing on page 3 was changed by me. Why delete all the answers on page 3? I guess that is just how the system works....
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago - 7 years 9 months ago #139543 by Sweden

DenisChenu wrote: Hi,

Maybe you can find a way to use a plugin to set the step according to some conditions. Take inspiration here : framagit.org/SondagePro-LimeSurvey-plugi...r/fixMaxStep.php#L85

If you think it's a bug and you use the last LimeSurvey version : report a bug.

Denis


Thanks Denis, but I'm not sure how to use that. I think I need to learn more first.... :unsure:
Last edit: 7 years 9 months ago by Sweden. Reason: somehow deleted my first answer... posting it again
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #139545 by Sweden
I think I got a solution to this problem, but I need some help with the code.

Could I insert another page/questiongroup between page 2 and 3 that only contains one hidden question (list, radio). The question result is defaulted to the value "user" and if the value is "user" (which it always will be by default) it will autosubmit/click the next button so the next page will load instantly. This way it will act as a "wall" between page 1+2 (that I don't want the users to change) and page 3+4 (that they are allowed to return to). The inserted javascript in the question will autosubmit automatically so I guess this hidden question/questiongroup wouldn't really be visible to the users (at least, that is what I am hoping for - they might see a quick page jump...)

I know how to hide the question via javascript, but how do I make it press the next button automatically, whenever the answer to the hidden question is "user"? I want to be able to change the answer for the hidden question (by prefilling the hidden question with the use of my own version of the users URL to the survey), so the default value changes from "user" to "admin" - this will prevent the whole autosubmit thing and remove the restrictions for me (it would be useful in case I need to change one of the results for a user on page 1-2).

Any suggestions how that javascript would look like? In summary:
  1. Hide question.
  2. Autosubmit if question result is "user"
  3. Do nothing if question result is "admin"
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago - 7 years 9 months ago #139557 by tpartner
Something like this in the source of the question should do the trick (untested as I'm writing on my phone):

Code:
<script type="text/javascript" charset="utf-8">
  $(document).ready(function() {
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Hide the question 
    $(thisQuestion).hide();
 
    // Handle auto-submit
    if($('input.text', thisQuestion).val() == 'user') {
      $('#movenextbtn').trigger ('click');
    }
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 9 months ago by tpartner. Reason: Fix typo in code
The following user(s) said Thank You: Sweden
The topic has been locked.
  • Sweden
  • Sweden's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago - 7 years 9 months ago #139619 by Sweden
Thanks Tony! Sorry for my delayed response - everything takes a long time here :)

At first I couldn't make it work at all, but it worked fine after adding a }); at the end and after changing the input.text to input.radio. Little detail (you did say it was untested), but I thought I should mention it if someone else should use your code. Thanks for writing all that on your phone, I wish I was that good!

Btw. I realize that it is very easy to bypass javascript so that the above code won't prevent some of the more advanced users from accessing page 1+2 later on. Do you have any ideas how I can prevent that? I guess I can't really hide or encrypt javascript.... but are there any other options that you know of?

Thanks again! Every forum should have someone like you. I can see that you have helped many people here.
Last edit: 7 years 9 months ago by Sweden.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #139625 by DenisChenu
Hi,

I have no idea if it can work but :
- put 1==2 in the relevance equation of the question added with javascript.

Then we have :
- Step 1 : the first group
- Step 2 : a group with a question never shown
- Step 3 : 2n group
- Step 4 : a group with a question never shown
- Step 5 : 3rd group

If an user closes his browser at step 5, when he come back : limesurvey put step to 4 : no question => go to next step : the 5 ; 3rd group.

If it work : it's done in PHP , not in javascript.

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: Sweden
The topic has been locked.
More
7 years 9 months ago #139645 by Ben_V

tpartner wrote: ...untested as I'm writing on my phone):

ajax call support ? :laugh:

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #139649 by tpartner
:laugh:

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose