View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
04671Bug reportsConditionspublic2010-10-19 21:12
Reporteruser10091Assigned ToDenisChenu  
PrioritylowSeverityminor 
Status closedResolutionfixed 
Product Version1.90+ 
Fixed in Version1.90+ 
Summary04671: Numeric question, force 1 decimal validation fails due to rounding
Description

22.0 becomes 22 and the validation fails

Steps To Reproduce
  1. Create numeric question
  2. add validation /^(0?[0-9]?[0-9]|[1-4][0-9][0-9]|500).[0-9]{1}$/
  3. Try to enter 22.1 (works)
  4. Try to enter 22.0 (fails, number is being rounded somehow)
Additional Information

Versie 1.90+ Build

Tagsconditions, question, regular expressions
Attached Files
Bug heat10
Complete LimeSurvey version number (& build)9130
I will donate to the project if issue is resolved
Browser
Database type & versionMysql
Server OS (if known)Ubuntu 4
Webserver software & version (if known)Apache
PHP Version5.3.2

Users monitoring this issue

DenisChenu

Activities

Mazi

Mazi

2010-10-14 12:00

updater   ~13168

Please attach a simple survey we can use for testing.

user10091

2010-10-14 12:29

  ~13169

Some more debug information:
Regex checked on: http://regexpal.com/ and it works correctly.
Attachted an example of a survey suffering the problem.
Try to enter 22.0 as answer on question "frgripstrength1", it will round/fail when the survey is live. (Somehow it works correctly when the survey is not being live)

DenisChenu

DenisChenu

2010-10-14 19:39

developer   ~13188

Hello,

In your survey you use a numerical input.
If you want a . in your answer : it's a text-input.

You can use text-short with 'numeric only' attribute. (i test it, and it work like you want)

If you want to use a numerical input, you have to accept 22 (without the dot) in your regexp.

:)

c_schmitz

c_schmitz

2010-10-14 20:38

administrator   ~13189

well I symp with the OP because if you are knitpicking the value entered is 2.0 and so the regex should validate it.
Of course it forces the user to enter '2.0' even if just '2' would be enough.
Still the regex should validate the mainly unaltered string, shouldn't it?

Question is if the effort is worth it, so the source where the 2.0 is straightened to 2 should be checked.

c_schmitz

c_schmitz

2010-10-14 20:38

administrator   ~13190

Shnoulle, would you like to have a look at it?

DenisChenu

DenisChenu

2010-10-15 08:57

developer   ~13198

Last edited: 2010-10-15 08:59

If i understand right,

You want regexp is OK for 2.0 in numerical type question ?

Numerical input : filter the input with [-0123456789.] (like js function) , test regexp and after floatval() the value to be integrated in sql.

I take it, but i remove urgent cause there are other possibility :)

c_schmitz

c_schmitz

2010-10-15 10:14

administrator   ~13199

yep

DenisChenu

DenisChenu

2010-10-16 17:15

developer   ~13213

Fixed in 9256

Replace core/filter/sanitize_float function.

DenisChenu

DenisChenu

2010-10-16 20:29

developer   ~13214

Last edited: 2010-10-16 20:46

Oups using a PHP5.2 function

revert the commit and find a good solution.

It seems if :
First time we get to the question , if we put 2.0, it's OK
But if we put 2 and after 2.0 it's not working, right ?

DenisChenu

DenisChenu

2010-10-16 21:28

developer   ~13216

Resolved in 9259.

With a goodest solution.

c_schmitz

c_schmitz

2010-10-19 21:12

administrator   ~13266

Released in 1.90 plus release.

Issue History

Date Modified Username Field Change
2010-10-12 18:39 user10091 New Issue
2010-10-12 18:39 user10091 Status new => assigned
2010-10-12 18:39 user10091 Assigned To => lemeur
2010-10-14 12:00 Mazi Note Added: 13168
2010-10-14 12:00 Mazi Status assigned => feedback
2010-10-14 12:29 user10091 Note Added: 13169
2010-10-14 12:29 user10091 Status feedback => assigned
2010-10-14 12:29 user10091 File Added: limesurvey_survey_83383.lss
2010-10-14 12:30 user10091 Issue Monitored: user10091
2010-10-14 17:05 user10091 Tag Attached: conditions
2010-10-14 17:05 user10091 Tag Attached: question
2010-10-14 17:05 user10091 Tag Attached: regular expressions
2010-10-14 19:39 DenisChenu Note Added: 13188
2010-10-14 19:44 Mazi Status assigned => feedback
2010-10-14 20:22 DenisChenu Issue Monitored: DenisChenu
2010-10-14 20:38 c_schmitz Note Added: 13189
2010-10-14 20:38 c_schmitz Note Added: 13190
2010-10-15 08:57 DenisChenu Note Added: 13198
2010-10-15 08:58 DenisChenu Assigned To lemeur => DenisChenu
2010-10-15 08:58 DenisChenu Status feedback => assigned
2010-10-15 08:58 DenisChenu Status assigned => confirmed
2010-10-15 08:59 DenisChenu Note Edited: 13198
2010-10-15 08:59 DenisChenu Priority urgent => low
2010-10-15 08:59 DenisChenu Severity partial_block => minor
2010-10-15 10:14 c_schmitz Note Added: 13199
2010-10-15 10:14 c_schmitz Status confirmed => assigned
2010-10-16 17:15 DenisChenu Note Added: 13213
2010-10-16 17:15 DenisChenu Status assigned => resolved
2010-10-16 17:15 DenisChenu Fixed in Version => 1.90+
2010-10-16 17:15 DenisChenu Resolution open => fixed
2010-10-16 20:29 DenisChenu Status resolved => assigned
2010-10-16 20:29 DenisChenu Note Added: 13214
2010-10-16 20:46 DenisChenu Note Edited: 13214
2010-10-16 21:28 DenisChenu Note Added: 13216
2010-10-16 21:28 DenisChenu Status assigned => resolved
2010-10-19 21:12 c_schmitz Note Added: 13266
2010-10-19 21:12 c_schmitz Status resolved => closed
2021-08-03 18:52 guest Bug heat 8 => 10