Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

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

'Resume later...' modify URL for user to bookmark - HACK 1 Jahr 8 Monate her #90676

  • helper
  • helpers Avatar
  • OFFLINE
  • Expert Lime
  • Beiträge: 126
  • Dank erhalten: 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>";
Letzte Änderung: 1 Jahr 8 Monate her von helper.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 Jahr 8 Monate her #90687

  • Fred
  • Freds Avatar
  • OFFLINE
  • Gold Lime
  • Beiträge: 163
  • Dank erhalten: 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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 Jahr 8 Monate her #90688

  • helper
  • helpers Avatar
  • OFFLINE
  • Expert Lime
  • Beiträge: 126
  • Dank erhalten: 18
  • Karma: 0
bugs.limesurvey.org/view.php?id=7135

Also, I am working on a solution here that works in all browsers.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 Jahr 8 Monate her #90689

  • Fred
  • Freds Avatar
  • OFFLINE
  • Gold Lime
  • Beiträge: 163
  • Dank erhalten: 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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 Jahr 8 Monate her #90692

  • helper
  • helpers Avatar
  • OFFLINE
  • Expert Lime
  • Beiträge: 126
  • Dank erhalten: 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>";
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: 'Resume later...' modify URL for user to bookmark - HACK 1 Jahr 8 Monate her #90693

  • helper
  • helpers Avatar
  • OFFLINE
  • Expert Lime
  • Beiträge: 126
  • Dank erhalten: 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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.261 Sekunden
Donation Image