Index: group.php
===================================================================
--- group.php	(revision 7789)
+++ group.php	(working copy)
@@ -59,6 +59,9 @@
 }
 
 //SEE IF THIS GROUP SHOULD DISPLAY
+global $show_empty_group_if_the_last_group_is_hidden;
+my $show_empty_group = false;
+
 if (isset($move) && $_SESSION['step'] != 0 && $move != "movesubmit")
 {
 	while(checkgroupfordisplay($_SESSION['grouplist'][$_SESSION['step']-1][0]) === false)
@@ -73,9 +76,19 @@
         }
         if ($_SESSION['step']>$_SESSION['totalsteps']) 
         {
-            $move = "movesubmit";
-		submitanswer(); // complete this answer (submitdate)
-            break;
+			// We are skipping groups, but we moved 'off' the last group.
+			// Now choose to implement an implicit submit (old behaviour),
+			// or create an empty page giving the user the explicit option to submit.
+			if (isset($show_empty_group_if_the_last_group_is_hidden) && $show_empty_group_if_the_last_group_is_hidden == true)
+			{
+				$show_empty_group = true;
+				break;
+			} else
+			{
+            	$move = "movesubmit";
+				submitanswer(); // complete this answer (submitdate)
+            	break;
+			}
         } 
 	}
 }
@@ -297,10 +310,17 @@
 //******************************************************************************************************
 
 //GET GROUP DETAILS
-$grouparrayno=$_SESSION['step']-1;
-$gid=$_SESSION['grouplist'][$grouparrayno][0];
-$groupname=$_SESSION['grouplist'][$grouparrayno][1];
-$groupdescription=$_SESSION['grouplist'][$grouparrayno][2];
+if ($show_empty_group) {
+	$gid=-1; // Make sure the gid is unused. This will assure that the foreach (fieldarray as ia) has no effect.
+	$groupname=$clang->gT("Finalising your survey");
+	$groupdescription=$clang->gT("There are no more questions. If you are satisfied, press the <submit> button");
+} else
+{
+	$grouparrayno=$_SESSION['step']-1;
+	$gid=$_SESSION['grouplist'][$grouparrayno][0];
+	$groupname=$_SESSION['grouplist'][$grouparrayno][1];
+	$groupdescription=$_SESSION['grouplist'][$grouparrayno][2];
+}
 
 require_once("qanda.php"); //This should be qanda.php when finished
 
@@ -376,7 +396,12 @@
 } //end iteration
 
 
-$percentcomplete = makegraph($_SESSION['step'], $_SESSION['totalsteps']);
+if ($show_empty_group) {
+	$percentcomplete = makegraph($_SESSION['totalsteps'], $_SESSION['totalsteps']);
+} else
+{
+	$percentcomplete = makegraph($_SESSION['step'], $_SESSION['totalsteps']);
+}
 $languagechanger = makelanguagechanger();
 
 //READ TEMPLATES, INSERT DATA AND PRESENT PAGE
@@ -409,7 +434,12 @@
     <!--\n";
     
 // Find out if there are any array_filter questions in this group
-$array_filterqs = getArrayFiltersForGroup($surveyid,$gid);
+if ($show_empty_group) {
+	unset($array_filterqs);
+} else
+{
+	$array_filterqs = getArrayFiltersForGroup($surveyid,$gid);
+}
 
 print <<<END
 	function noop_checkconditions(value, name, type)
Index: config-defaults.php
===================================================================
--- config-defaults.php	(revision 7789)
+++ config-defaults.php	(working copy)
@@ -345,6 +345,31 @@
  */
 $hide_groupdescr_allinone=true;
 
+/**
+ * Before 1.87, the user may not see a <submit> button.
+ * The variable show_empty_group_if_the_last_group_is_hidden can change this behaviour.
+ * The default is true; to get the old behaviour, change the variable to false.
+ *
+ * DETAILS OF THE OLD BEHAVIOUR (set variable to false)
+ * Suppose:
+ * = The survey is in group mode.
+ * = The last group has only conditional questions.
+ * = None of the last group's conditions are satisfied.
+ *
+ * In other words: the last group of the survey should be skipped.
+ *
+ * Then the <submit> button does not show anywhere, leaving the user questioning
+ * if the survey was submitted or not.
+ * The effect is that the <next> button on the previous group's screen is actually
+ * not only a <next>, but also a <submit> without the user seeing it.
+ *
+ * DETAILS OF THE NEW BEHAVIOUR (set variable to true)
+ * If the user of a group survey presses <next> and the last group has no questions
+ * (due to unsatisfied conditions), present an "empty" group, with a <submit> button.
+ * The group title is something descriptive, the <prev> and other buttons are also
+ * available (if appropriate).
+ */
+$show_empty_group_if_the_last_group_is_hidden=true;
 
 /**
  * Use FireBug Lite for JavaScript and template development and testing.
