View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
05017Bug reportsSurvey takingpublic2011-05-04 19:48
Reporterduvemyster Assigned Tomagiclko 
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.91RC5 
Fixed in Version1.91 
Summary05017: In Array (Texts) set to Numbers Only, Negative entered in parenthesis mess up totals and a minus sign use is prevented
Description

"Array (Texts)" include a sweet totals feature. However, turning on "Numbers Only" prevents entry of Negative Numbers.

Steps To Reproduce
  1. Set a question type to Array (Texts) and setup subquestions for X and Y
  2. Edit Question
  3. Show advanced settings
  4. Numbers only: Yes
  5. Show Totals for: Rows, Columns, or Both rows and columns
  6. Preview this question or otherwise try it out in a survey. Entry of a negative number in the form of "-100" is prevented, and entry in the form of "(100)" leads to the appearance of "NaN" in totals.
TagsNo tags attached.
Attached Files
05017_dev.patch (1,242 bytes)   
Index: scripts/survey_runtime.js
===================================================================
--- scripts/survey_runtime.js	(revision 10000)
+++ scripts/survey_runtime.js	(working copy)
@@ -743,7 +743,15 @@
 			{
 				if(i == (l - 1))
 				{
-					_bits[i][vid].value = qt;
+					//check if sum is a number
+                    if(isNaN(qt))
+                    {
+                        _bits[i][vid].value = "Not a number";
+                    }
+                    else
+                    {
+                        _bits[i][vid].value = qt;                        
+                    }
 				}
 				else if(_bits[i][vid].value)
 				{
@@ -779,7 +787,14 @@
 			{
 				if(i == (l - 1))
 				{
-					_bits[hid][i].value = qt;
+					if (isNaN(qt))
+                    {
+                        _bits[hid][i].value = "Not a number"
+                    }
+                    else
+                    {
+                        _bits[hid][i].value = qt;
+                    }
 				}
 				else if(_bits[hid][i].value)
 				{
@@ -851,6 +866,7 @@
 				case 105:
 				case 110:
 				case 109:
+                case 189:
 					return(e.keyCode);
 				default:
 				//alert(e.keyCode);
05017_dev.patch (1,242 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)9882
I will donate to the project if issue is resolvedNo
Browserany
Database type & versionMySQL 5.1.47
Server OS (if known)Linux
Webserver software & version (if known)Apache 2.2.17
PHP Version5.2.16

Users monitoring this issue

There are no users monitoring this issue.

Activities

magiclko

magiclko

2011-04-14 11:21

reporter   ~14813

added '-' key code, and now instead of "NaN" it display more readable "Not a number" message.

c_schmitz

c_schmitz

2011-04-16 19:45

administrator   ~14830

please commit.

Issue History

Date Modified Username Field Change
2011-03-11 09:10 duvemyster New Issue
2011-03-11 12:55 c_schmitz Assigned To => Evan
2011-03-11 12:55 c_schmitz Status new => assigned
2011-04-13 16:36 c_schmitz Assigned To Evan => magiclko
2011-04-14 11:13 magiclko File Added: 05017_dev.patch
2011-04-14 11:21 magiclko Note Added: 14813
2011-04-16 17:37 magiclko Assigned To magiclko => c_schmitz
2011-04-16 19:45 c_schmitz Note Added: 14830
2011-04-16 19:48 c_schmitz Assigned To c_schmitz => magiclko
2011-04-16 20:56 magiclko Status assigned => resolved
2011-05-04 19:48 c_schmitz Status resolved => closed
2011-05-04 19:48 c_schmitz Resolution open => fixed
2011-05-04 19:48 c_schmitz Fixed in Version => 1.91