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

More
4 years 4 months ago - 4 years 4 months ago #90676 by helper
helper created the topic: 'Resume later...' modify URL for user to bookmark - HACK
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: 4 years 4 months ago by helper.

Please Log in to join the conversation.

More
4 years 4 months ago #90687 by Fred01
Fred01 replied the topic: 'Resume later...' modify URL for user to bookmark - HACK
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.

Please Log in to join the conversation.

More
4 years 4 months ago #90688 by helper
helper replied the topic: 'Resume later...' modify URL for user to bookmark - HACK
bugs.limesurvey.org/view.php?id=7135

Also, I am working on a solution here that works in all browsers.

Please Log in to join the conversation.

More
4 years 4 months ago #90689 by Fred01
Fred01 replied the topic: 'Resume later...' modify URL for user to bookmark - HACK
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.

Please Log in to join the conversation.

More
4 years 4 months ago #90692 by helper
helper replied the topic: 'Resume later...' modify URL for user to bookmark - HACK
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>";

Please Log in to join the conversation.

More
4 years 4 months ago #90693 by helper
helper replied the topic: 'Resume later...' modify URL for user to bookmark - HACK
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.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now