Welcome, Guest
Username: Password: Remember me

TOPIC: 'Resume later...' modify URL for user to bookmark - HACK

'Resume later...' modify URL for user to bookmark - HACK 1 year 6 months ago #90676

  • helper
  • helper's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 126
  • Thank you received: 18
  • Karma: 0
I had an issue with the resume later in that the user was not able to bookmark the point in which they saved within a survey. After putting in a bug report, I was advised that the clean URL was done for security and other reasons. The following is my hack to allow folks to have a URL that they can return to when they save.

NOTE: This hack will only work on modern browsers.

change .../application/controllers/surveys/index.php from:
echo "<script type='text/javascript'> $(document).ready( function() { alert('".$clang->gT("Your responses were successfully saved.","js")."');}) </script>";

to:
echo "<script type='text/javascript'>
                $(document).ready( function() {                 
                window.history.pushState('','',window.location+'/sid/".$surveyid."/token/".$token."');
                alert('".$clang->gT("Your responses were successfully saved. 
                    Please bookmark this page so that you can return and continue later.","js")."');}) 
</script>";
Last Edit: 1 year 6 months ago by helper.
The administrator has disabled public write access.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 year 6 months ago #90687

  • Fred
  • Fred's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 163
  • Thank you received: 5
  • Karma: 3
I couldn't find the bug report. Do you have the link?

Is this intended for surveys with tokens or without?

I agree all of the save/resume features in LS are pretty confusing. My preference for allowing save/resume is token persistence, but if you hit "resume later" it saves but leaves you right at the same page, which is confusing. They also used to send an email every time somebody hit save, which got a little tiresome. Then they got rid of the email and people couldn't find the original invitation with the link.

My solution was to put a login "wrapper" script around the survey. They pass through the script to reach the survey so the actual survey url is never exposed, and when they press resume, I trap that and prompt them to create a username and password in my login system. After that, anybody who comes in with the original invitation URL can only resume the survey with username and password. And the participant doesn't need the "long" invitation URL because he can just go to the research home page (eg, mysurveys.com or whatever) and log in there and see his survey.
The administrator has disabled public write access.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 year 6 months ago #90688

  • helper
  • helper's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 126
  • Thank you received: 18
  • Karma: 0
bugs.limesurvey.org/view.php?id=7135

Also, I am working on a solution here that works in all browsers.
The administrator has disabled public write access.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 year 6 months ago #90689

  • Fred
  • Fred's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 163
  • Thank you received: 5
  • Karma: 3
I see thanks. So you are using tokens. Personally I like the clean URL, because as soon as some data is in the survey there are privacy/confidentiality issues and I don't want that URL to be left around in bookmarks or accidentally forwarded to other people etc. But different strokes...

Maybe it should be optional.
The administrator has disabled public write access.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 year 6 months ago #90692

  • helper
  • helper's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 126
  • Thank you received: 18
  • Karma: 0
Updated for all browser... ugly, but it works:
echo "\t\t<script type='text/javascript'>
                $(document).ready( function() {
                    url_builder = window.location+'/sid/".$surveyid."/token/".$token."';
                    if (!/sid/g.test(window.location)) {
                        alert('".$clang->gT("Your responses were successfully saved.  Please bookmark this page so that you can return and continue later.","js")."');
                        window.location.href = url_builder;
                    }
                })
                </script>";
The administrator has disabled public write access.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 year 6 months ago #90693

  • helper
  • helper's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 126
  • Thank you received: 18
  • Karma: 0
Yes, we do use tokens (but the client never sees these) - we have hijacked the entire logon process and removed email check, etc. and came up with our own that is based on a medical record number and another value for authentication. This allows our survey takers to take the survey multiple times having different tokens for history.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.261 seconds
Donation Image