View Issue Details

IDProjectCategoryView StatusLast Update
02999Development (No Category)public2009-06-02 22:08
ReporterbdgAssigned Toc_schmitz 
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Product Version1.80 
Target VersionFixed in Version1.85 
Summary02999: Suppress mandatory & validation popups
Description

My employer wants to suppress validation and mandatory question javascript popups while someone is doing a survey and show the message at the top of the page instead for aesthetic reasons. I created a diff of my changes in case anyone finds it useful.

Additional Information

I started with a workaround from elsewhere on this site and expanded it into a config option. It works in 'survey at once', 'group by group', and 'question by question' mode with any template. The massage at the top of page uses the same CSS format as the other mandatory warning text on a page for consistency with the template.

TagsNo tags attached.

Relationships

related to 03645 closedjcleeland Bug reports Ranking question show popup when $showpopups = 0; 

Activities

2009-03-27 05:04

 

no_popup.diff (4,828 bytes)
Index: config-defaults.php
===================================================================
--- config-defaults.php	(revision 6584)
+++ config-defaults.php	(working copy)
@@ -90,9 +90,10 @@
 $memorylimit        =  '32M';   // This sets how much memory LimeSurvey can access. 16M is the minimum (M=mb) recommended.
 
 $sessionlifetime    =  3600;    // How long until a survey session expires in seconds
+$showpopups         =   1;                // Show popup messages if mandatory or conditional questions have not been answered correctly.
+                                          // 1=Show popup message, 0=Show message on page instead.
 
 
-
 /**
  * SESSION SAVE PATH  -  Use only as LAST resort.
  *
Index: group.php
===================================================================
--- group.php	(revision 6584)
+++ group.php	(working copy)
@@ -816,7 +816,18 @@
 }
 echo "\n";
 
+//Display the "mandatory" message on page if necessary
+if (isset($showpopups) && $showpopups == 0 && isset($notanswered) && $notanswered == true)
+{
+	echo "<p><span class='errormandatory'>" . $clang->gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed") . ".</span></p>";
+}
 
+//Display the "validation" message on page if necessary
+if (isset($showpopups) && $showpopups == 0 && isset($notvalidated) && $notvalidated == true)
+{
+	echo "<p><span class='errormandatory'>" . $clang->gT("One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid") . ".</span></p>";
+}
+
 echo "\n\n<!-- PRESENT THE QUESTIONS -->\n";
 if (isset($qanda) && is_array($qanda))
 {
Index: qanda.php
===================================================================
--- qanda.php	(revision 6584)
+++ qanda.php	(working copy)
@@ -661,7 +661,7 @@
 	//This sets the mandatory popup message to show if required
 	//Called from question.php, group.php or survey.php
 	if ($notanswered === null) {unset($notanswered);}
-	if (isset($notanswered) && is_array($notanswered)) //ADD WARNINGS TO QUESTIONS IF THEY WERE MANDATORY BUT NOT ANSWERED
+	if (isset($notanswered) && is_array($notanswered) && isset($showpopups) && $showpopups == 1) //ADD WARNINGS TO QUESTIONS IF THEY WERE MANDATORY BUT NOT ANSWERED
 	{
 		global $mandatorypopup, $popup, $clang;
 		//POPUP WARNING
@@ -694,7 +694,7 @@
 	//Called from question.php, group.php or survey.php
 	if ($notvalidated === null) {unset($notvalidated);}
 	$qtitle="";
-	if (isset($notvalidated) && is_array($notvalidated))  //ADD WARNINGS TO QUESTIONS IF THEY ARE NOT VALID
+	if (isset($notvalidated) && is_array($notvalidated) && isset($showpopups) && $showpopups == 1)  //ADD WARNINGS TO QUESTIONS IF THEY ARE NOT VALID
 	{
 		global $validationpopup, $vpopup, $clang;
 		//POPUP WARNING
Index: question.php
===================================================================
--- question.php	(revision 6584)
+++ question.php	(working copy)
@@ -490,6 +490,18 @@
 	echo "\t//-->\n";
 	echo "\t</script>\n\n";
 
+	//Display the "mandatory" message on page if necessary
+	if (isset($showpopups) && $showpopups == 0 && isset($notanswered) && $notanswered == true)
+	{
+		echo "<p><span class='errormandatory'>" . $clang->gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed") . ".</span></p>";
+	}
+
+	//Display the "validation" message on page if necessary
+	if (isset($showpopups) && $showpopups == 0 && isset($notvalidated) && $notvalidated == true)
+	{
+		echo "<p><span class='errormandatory'>" . $clang->gT("One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid") . ".</span></p>";
+	}
+
 	echo "\n\n<!-- PRESENT THE QUESTIONS -->\n";
 	if (is_array($qanda))
 	{
Index: survey.php
===================================================================
--- survey.php	(revision 6584)
+++ survey.php	(working copy)
@@ -632,6 +632,18 @@
 ."\t//-->\n"
 ."\t</script>\n\n"; // End checkconditions javascript function
 
+//Display the "mandatory" message on page if necessary
+if (isset($showpopups) && $showpopups == 0 && isset($notanswered) && $notanswered == true)
+{
+	echo "<p><span class='errormandatory'>" . $clang->gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed") . ".</span></p>";
+}
+
+//Display the "validation" message on page if necessary
+if (isset($showpopups) && $showpopups == 0 && isset($notvalidated) && $notvalidated == true)
+{
+	echo "<p><span class='errormandatory'>" . $clang->gT("One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid") . ".</span></p>";
+}
+
 foreach ($_SESSION['grouplist'] as $gl)
 {
 	$gid=$gl[0];
no_popup.diff (4,828 bytes)
Mazi

Mazi

2009-04-06 14:06

partner   ~07468

This might be a nice improvement. I hate these javascript popups ;-)

Issue History

Date Modified Username Field Change
2009-03-27 05:04 bdg New Issue
2009-03-27 05:04 bdg Status new => assigned
2009-03-27 05:04 bdg Assigned To => user372
2009-03-27 05:04 bdg File Added: no_popup.diff
2009-03-27 05:04 bdg Build Number => 6584
2009-03-27 05:04 bdg Browser => any
2009-03-27 05:04 bdg Database & DB-Version => MySQL 5.0.51
2009-03-27 05:04 bdg Operating System (Server) => MacOS
2009-03-27 05:04 bdg Webserver => Apache 1.3.33
2009-03-27 05:04 bdg PHP Version => 5.0.3
2009-03-27 10:03 user372 Project Bug reports => Development
2009-03-27 10:04 c_schmitz Assigned To user372 => c_schmitz
2009-04-06 14:06 Mazi Note Added: 07468
2009-05-25 17:19 c_schmitz Status assigned => resolved
2009-05-25 17:19 c_schmitz Fixed in Version => 1.85
2009-05-25 17:19 c_schmitz Resolution open => fixed
2009-06-02 22:08 c_schmitz Status resolved => closed
2009-09-04 21:55 user372 Relationship added related to 03645
2010-10-25 00:20 c_schmitz Category Survey at Runtime => (No Category)