View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
03445Bug reportsSurvey takingpublic2009-08-03 09:22
Reporteruser3106Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.81+ 
Fixed in Version1.85+ 
Summary03445: Disabling going to previous q: does not work if back button used in browser
Description

When I disable the option for a user to go to a previous question I can still use the back button in the browser. Can it be confirmed that this is a bug or not?

Ofcourse, when a participant uses the back button, the Limesurvey needs to detect it is the last page the participant is requesting. If not then return the last page again.

Can I get suggestions where to look in the source code to fix it myself?

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)6617
I will donate to the project if issue is resolved
BrowserFirefox 3.x and IE 7.0
Database type & versionXAMP 1.6.8
Server OS (if known)
Webserver software & version (if known)
PHP Version

Users monitoring this issue

There are no users monitoring this issue.

Activities

user3106

2009-07-08 10:58

  ~08793

Proof of concept below

How can this be integrated into limesurvey? I saw that a session variable $_SESSION['step'] is used?

<?php
// counter.php: test if using back button in a browser is used

// Turn on error reporting for this page
error_reporting(E_ALL);
ini_set("display_errors", true);

session_start();

if (isset($_POST['logout'])) {
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();
exit("session destroyed");
}

if (isset($_SESSION['counter']) && isset($_POST['counter'])) {
$counter = $_SESSION['counter'];
if ($counter!=$_POST['counter']) echo "Detected going to previous page!<BR>";
else {
$counter++;
$_SESSION['counter'] = $counter;
}
} else {
$_SESSION['counter']=0;
$counter=0;
}

echo "
<html>
<body>
<form action='counter.php' method='post'>
<input type='hidden' name='counter' value='$counter'>
<input type='submit' value='$counter' name='submit'>
<input type='submit' value='logout' name='logout'>
</form>
</body>
</html>
";

?>

user3106

2009-07-08 12:47

  ~08796

A quick hack to question.php (my own local installation) result in behavior I want. Change line 26 (build 6617) to:
if (isset($move) && $move == "movenext") {if ($_SESSION['step']==$thisstep) $_SESSION['step'] = $thisstep+1;}

It only updates the 'step' session variable if $thisstep (contains step var from last form post) is equal to the 'step' variable fount in the session.

Of course this is only a quick hack:

  • This now only works if you do question-by-question questionnaires
  • I don't know what happens with the reposted form data (if I reload any previous page through browser history). It didn't seem to affect the stored data.
  • The browser history gets mixed up, but I don't mind.

Can you confirm this does NOT cause harm?

Thanx!

c_schmitz

c_schmitz

2009-07-29 14:26

administrator   ~08984

Your solution looks fine. Thank you.

Issue History

Date Modified Username Field Change
2009-07-07 14:23 user3106 New Issue
2009-07-07 14:23 user3106 Status new => assigned
2009-07-07 14:23 user3106 Assigned To => user372
2009-07-07 14:23 user3106 Build Number => 6617
2009-07-07 14:23 user3106 Browser => Firefox 3.x and IE 7.0
2009-07-07 14:23 user3106 Database & DB-Version => XAMP 1.6.8
2009-07-07 23:36 user372 Assigned To user372 => c_schmitz
2009-07-08 10:58 user3106 Note Added: 08793
2009-07-08 12:47 user3106 Note Added: 08796
2009-07-29 14:26 c_schmitz Note Added: 08984
2009-07-29 14:26 c_schmitz Status assigned => resolved
2009-07-29 14:26 c_schmitz Fixed in Version => 1.85+
2009-07-29 14:26 c_schmitz Resolution open => fixed
2009-08-03 09:22 c_schmitz Status resolved => closed
2010-10-25 00:18 c_schmitz Category Survey at Runtime => Survey taking