View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
05144Bug reportsTheme editorpublic2011-05-15 12:26
Reportermot Assigned Toc_schmitz  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.90+ 
Fixed in Version1.91+ 
Summary05144: Register Form (Public) contains table-row for a hidden input field only.
Description

The current language variable is passed via a hidden field in the registration form (if part of the $_REQUEST).

That hidden field is added inside an additional table row which then exists only for a hidden field.

Steps To Reproduce

1.) Create a survey with public registration enabled (tokens must be enabled for that).

2.) Request the registration form (index.php) with a language set.

3.) The submit button of the registration form is moved "one line/row" away from the other registration fields.

Additional Information

It's quite easy to solve this issue by adding the hidden field right after the opening form element/tag.

Patch attached against Revision 9642. I'm new to development and was a bit unsure what to checkout from SVN to build patches again and ended up in source/limesurvey.

TagsNo tags attached.
Attached Files
form-language-hidden-input.diff (2,193 bytes)   
Index: common.php
===================================================================
--- common.php	(revision 9642)
+++ common.php	(working copy)
@@ -3085,8 +3085,18 @@
     if (strpos($line, "{REGISTERMESSAGE2}") !== false) $line=str_replace("{REGISTERMESSAGE2}", $clang->gT("You may register for this survey if you wish to take part.")."<br />\n".$clang->gT("Enter your details below, and an email containing the link to participate in this survey will be sent immediately."), $line);
     if (strpos($line, "{REGISTERFORM}") !== false)
     {
-        $registerform="<form method='post' action='{$publicurl}/register.php'>\n"
-        ."<table class='register' summary='Registrationform'>\n"
+        $registerform="<form method='post' action='{$publicurl}/register.php'>\n";
+        if (!isset($_REQUEST['lang']))
+        {
+            $reglang = GetBaseLanguageFromSurveyID($surveyid);
+        }
+        else
+        {
+            $reglang = returnglobal('lang');
+        }
+        $registerform .= "<input type='hidden' name='lang' value='".$reglang."' />\n";
+        
+        $registerform .= "<table class='register' summary='Registrationform'>\n"
         ."<tr><td align='right'>"
         ."<input type='hidden' name='sid' value='$surveyid' id='sid' />\n"
         .$clang->gT("First Name").":</td>"
@@ -3110,14 +3120,6 @@
             $registerform .= " value='".htmlentities(returnglobal('register_email'),ENT_QUOTES,'UTF-8')."'";
         }
         $registerform .= " /></td></tr>\n";
-        if (!isset($_REQUEST['lang']))
-        {
-            $reglang = GetBaseLanguageFromSurveyID($surveyid);
-        }
-        else
-        {
-            $reglang = returnglobal('lang');
-        }
 
 
         if (function_exists("ImageCreate") && captcha_enabled('registrationscreen',$thissurvey['usecaptcha']))
@@ -3126,7 +3128,6 @@
         }
 
 
-        $registerform .= "<tr><td align='right'><input type='hidden' name='lang' value='".$reglang."' /></td><td></td></tr>\n";
         /*      if(isset($thissurvey['attribute1']) && $thissurvey['attribute1'])
          {
          $registerform .= "<tr><td align='right'>".$thissurvey['attribute1'].":</td>\n"
form-language-hidden-input-head.diff (2,216 bytes)   
Index: common_functions.php
===================================================================
--- common_functions.php	(revision 10029)
+++ common_functions.php	(working copy)
@@ -3248,8 +3248,19 @@
     if (strpos($line, "{REGISTERMESSAGE2}") !== false) $line=str_replace("{REGISTERMESSAGE2}", $clang->gT("You may register for this survey if you wish to take part.")."<br />\n".$clang->gT("Enter your details below, and an email containing the link to participate in this survey will be sent immediately."), $line);
     if (strpos($line, "{REGISTERFORM}") !== false)
     {
-        $registerform="<form method='post' action='{$publicurl}/register.php'>\n"
-        ."<table class='register' summary='Registrationform'>\n"
+        $registerform="<form method='post' action='{$publicurl}/register.php'>\n";
+        if (!isset($_REQUEST['lang']))
+        {
+            $reglang = GetBaseLanguageFromSurveyID($surveyid);
+        }
+        else
+        {
+            $reglang = returnglobal('lang');
+        }
+        $registerform .= "<input type='hidden' name='lang' value='".$reglang."' />\n";
+
+
+        $registerform.="<table class='register' summary='Registrationform'>\n"
         ."<tr><td align='right'>"
         ."<input type='hidden' name='sid' value='$surveyid' id='sid' />\n"
         .$clang->gT("First name").":</td>"
@@ -3273,14 +3284,6 @@
             $registerform .= " value='".htmlentities(returnglobal('register_email'),ENT_QUOTES,'UTF-8')."'";
         }
         $registerform .= " /></td></tr>\n";
-        if (!isset($_REQUEST['lang']))
-        {
-            $reglang = GetBaseLanguageFromSurveyID($surveyid);
-        }
-        else
-        {
-            $reglang = returnglobal('lang');
-        }
 
 
         if (function_exists("ImageCreate") && captcha_enabled('registrationscreen',$thissurvey['usecaptcha']))
@@ -3289,7 +3292,6 @@
         }
 
 
-        $registerform .= "<tr><td align='right'><input type='hidden' name='lang' value='".$reglang."' /></td><td></td></tr>\n";
         /*      if(isset($thissurvey['attribute1']) && $thissurvey['attribute1'])
          {
          $registerform .= "<tr><td align='right'>".$thissurvey['attribute1'].":</td>\n"
5144.3-hidden-inputs-head.diff (2,446 bytes)   
Index: common_functions.php
===================================================================
--- common_functions.php	(revision 10029)
+++ common_functions.php	(working copy)
@@ -3248,10 +3248,20 @@
     if (strpos($line, "{REGISTERMESSAGE2}") !== false) $line=str_replace("{REGISTERMESSAGE2}", $clang->gT("You may register for this survey if you wish to take part.")."<br />\n".$clang->gT("Enter your details below, and an email containing the link to participate in this survey will be sent immediately."), $line);
     if (strpos($line, "{REGISTERFORM}") !== false)
     {
-        $registerform="<form method='post' action='{$publicurl}/register.php'>\n"
-        ."<table class='register' summary='Registrationform'>\n"
+        $registerform="<form method='post' action='{$publicurl}/register.php'>\n";
+        if (!isset($_REQUEST['lang']))
+        {
+            $reglang = GetBaseLanguageFromSurveyID($surveyid);
+        }
+        else
+        {
+            $reglang = returnglobal('lang');
+        }
+        $registerform .= "<input type='hidden' name='lang' value='".$reglang."' />\n";
+        $registerform .= "<input type='hidden' name='sid' value='$surveyid' id='sid' />\n";
+
+        $registerform.="<table class='register' summary='Registrationform'>\n"
         ."<tr><td align='right'>"
-        ."<input type='hidden' name='sid' value='$surveyid' id='sid' />\n"
         .$clang->gT("First name").":</td>"
         ."<td align='left'><input class='text' type='text' name='register_firstname'";
         if (isset($_POST['register_firstname']))
@@ -3273,14 +3283,6 @@
             $registerform .= " value='".htmlentities(returnglobal('register_email'),ENT_QUOTES,'UTF-8')."'";
         }
         $registerform .= " /></td></tr>\n";
-        if (!isset($_REQUEST['lang']))
-        {
-            $reglang = GetBaseLanguageFromSurveyID($surveyid);
-        }
-        else
-        {
-            $reglang = returnglobal('lang');
-        }
 
 
         if (function_exists("ImageCreate") && captcha_enabled('registrationscreen',$thissurvey['usecaptcha']))
@@ -3289,7 +3291,6 @@
         }
 
 
-        $registerform .= "<tr><td align='right'><input type='hidden' name='lang' value='".$reglang."' /></td><td></td></tr>\n";
         /*      if(isset($thissurvey['attribute1']) && $thissurvey['attribute1'])
          {
          $registerform .= "<tr><td align='right'>".$thissurvey['attribute1'].":</td>\n"
5144.3-hidden-inputs-head.diff (2,446 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)9642
I will donate to the project if issue is resolvedYes
Browser
Database type & versionMySQL 5 Family
Server OS (if known)WinXP Pro
Webserver software & version (if known)Apache 1.3
PHP Version5.3.5

Users monitoring this issue

There are no users monitoring this issue.

Activities

mot

mot

2011-05-02 23:13

reporter   ~14908

Added a patch against HEAD revision.

mot

mot

2011-05-06 16:44

reporter   ~14937

There is another hidden field in the form that could be moved to the top of the form (sid/$surveyid). I'll add another patch for HEAD.

c_schmitz

c_schmitz

2011-05-06 20:30

administrator   ~14945

Hello mot,
that looks great. Thank you very much.
If you have more patches keep them coming. You should also join the IRC chat and talk to me sometime so I can make you known to the team.

Issue History

Date Modified Username Field Change
2011-05-02 19:59 mot New Issue
2011-05-02 19:59 mot File Added: form-language-hidden-input.diff
2011-05-02 23:12 mot File Added: form-language-hidden-input-head.diff
2011-05-02 23:13 mot Note Added: 14908
2011-05-05 00:02 c_schmitz Assigned To => c_schmitz
2011-05-05 00:02 c_schmitz Status new => assigned
2011-05-06 16:44 mot Note Added: 14937
2011-05-06 16:47 mot File Added: 5144.3-hidden-inputs-head.diff
2011-05-06 20:30 c_schmitz Note Added: 14945
2011-05-06 20:30 c_schmitz Status assigned => resolved
2011-05-06 20:30 c_schmitz Fixed in Version => 1.91+
2011-05-06 20:30 c_schmitz Resolution open => fixed
2011-05-15 12:26 c_schmitz Status resolved => closed
2015-12-11 14:40 c_schmitz Category Templates => Theme editor