View Issue Details

IDProjectCategoryView StatusLast Update
04985Bug reports[All Projects] Survey takingpublic2011-04-11 11:34
ReportertpartnerAssigned Totpartner 
PrioritynormalSeveritymajor 
Status closedResolutionfixed 
Product Version1.91RC4 
Target Version1.91RC5Fixed in Version1.91RC6 
Summary04985: Form submit firing twice
DescriptionAn onclick function which includes an extra submit has been added to the "Next" button causing the submit function to fire twice when the button is clicked.

This causes any warnings such as minimum answers to be alerted twice and the survey advances despite the requirements not being met.

The function is submit_and_disable() in survey_runtime.js.

Does anyone know why this function which includes an unecessary submit was added to the next button or have any reason not to remove it?

See my attached patch.
Steps To ReproduceLoad up the attached survey which includes a mutiple-options question with "Minimum answeres" = 2.

In group 1, do NOT answer the multi-opts and click next.

The alert appears twice and the survey advances.
TagsNo tags attached.
Complete LimeSurvey version number (& build)9836
I will donate to the project if issue is resolvedNo
BrowserFireFox
Database & DB-VersionmySQL - 5.1.41
Operating System (Server)Win 7
Webserver software & versionApache - 2.2.14
PHP VersionPHP - 5.3.1

Activities

tpartner

tpartner

2011-02-28 23:56

developer  

limesurvey_survey_51464.lss (23,637 bytes)
tpartner

tpartner

2011-02-28 23:57

developer  

double_submit_fix.patch (3,163 bytes)
Index: index.php
===================================================================
--- index.php	(revision 9836)
+++ index.php	(working copy)
@@ -2905,24 +2905,24 @@
            //first step and we do not want to go back to the welcome screen since we don't show that...
            //so skip the prev button
         } else {
-            $surveymover .= "<input class='submit' accesskey='p' type='button' onclick=\"javascript:document.limesurvey.move.value = 'moveprev'; submit_and_disable();\" value=' &lt;&lt; "
+            $surveymover .= "<input class='submit' accesskey='p' type='button' onclick=\"javascript:document.limesurvey.move.value = 'moveprev'; $('#limesurvey').submit(); disable_navigator();\" value=' &lt;&lt; "
             . $clang->gT("Previous")." ' name='move2' id='moveprevbtn' $disabled />\n";
         }
     }
     if (isset($_SESSION['step']) && $_SESSION['step'] && (!$_SESSION['totalsteps'] || ($_SESSION['step'] < $_SESSION['totalsteps'])))
     {
-        $surveymover .=  "\t<input class='submit' type='submit' accesskey='n' onclick=\"javascript:document.limesurvey.move.value = 'movenext'; submit_and_disable();\" value=' "
+        $surveymover .=  "\t<input class='submit' type='submit' accesskey='n' onclick=\"javascript:document.limesurvey.move.value = 'movenext'; disable_navigator();\" value=' "
         . $clang->gT("Next")." &gt;&gt; ' name='move2' id='movenextbtn' $disabled />\n";
     }
     // here, in some lace, is where I must modify to turn the next button conditionable
     if (!isset($_SESSION['step']) || !$_SESSION['step'])
     {
-        $surveymover .=  "\t<input class='submit' type='submit' accesskey='n' onclick=\"javascript:document.limesurvey.move.value = 'movenext'; submit_and_disable();\" value=' "
+        $surveymover .=  "\t<input class='submit' type='submit' accesskey='n' onclick=\"javascript:document.limesurvey.move.value = 'movenext'; disable_navigator();\" value=' "
         . $clang->gT("Next")." &gt;&gt; ' name='move2' id='movenextbtn' $disabled />\n";
     }
     if (isset($_SESSION['step']) && $_SESSION['step'] && ($_SESSION['step'] == $_SESSION['totalsteps']) && $presentinggroupdescription == "yes")
     {
-        $surveymover .=  "\t<input class='submit' type='submit' onclick=\"javascript:document.limesurvey.move.value = 'movenext'; submit_and_disable();\" value=' "
+        $surveymover .=  "\t<input class='submit' type='submit' onclick=\"javascript:document.limesurvey.move.value = 'movenext'; disable_navigator();\" value=' "
         . $clang->gT("Next")." &gt;&gt; ' name='move2' id=\"movenextbtn\" $disabled />\n";
     }
     if (($_SESSION['step'] && ($_SESSION['step'] == $_SESSION['totalsteps']) && !$presentinggroupdescription) || $thissurvey['format'] == 'A')
Index: scripts/survey_runtime.js
===================================================================
--- scripts/survey_runtime.js	(revision 9836)
+++ scripts/survey_runtime.js	(working copy)
@@ -437,9 +437,8 @@
 		}
 }
 
-function submit_and_disable()
+function disable_navigator()
 {
-	$('#limesurvey').submit();
 	$('#navigator input').attr('disabled', 'disabled');
 }
 
double_submit_fix.patch (3,163 bytes)
tpartner

tpartner

2011-03-01 21:39

developer   ~14300

Fixed in revision 9539

Issue History

Date Modified Username Field Change
2011-02-28 23:56 tpartner New Issue
2011-02-28 23:56 tpartner File Added: limesurvey_survey_51464.lss
2011-02-28 23:57 tpartner File Added: double_submit_fix.patch
2011-03-01 21:39 tpartner Assigned To => tpartner
2011-03-01 21:39 tpartner Status new => assigned
2011-03-01 21:39 tpartner Note Added: 14300
2011-03-01 21:39 tpartner Status assigned => resolved
2011-03-01 21:39 tpartner Resolution open => fixed
2011-04-11 11:34 c_schmitz Fixed in Version => 1.91RC6
2011-04-11 11:34 c_schmitz Status resolved => closed