View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
10812Bug reportsSurvey editingpublic2016-04-01 11:36
Reporterollehar Assigned ToDenisChenu  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version2.50.x 
Target Version2.50.xFixed in Version2.50.x 
Summary10812: Default answers must check for type
Description

Default answers must check for type. Otherwise pgsql will throw exception.

Steps To Reproduce

Create multiple numeric question.
Set default answer to "23,asdasd"
Activate survey
Execute survey
pgsql: Error executing query in dbExecuteAssoc:CDbCommand failed to execute the SQL statement: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type numeric: "35,232asd" LINE 1: ...223698X272X3728SQ001"='0', "223698X272X3732SQ001"='35,232asd... ^. The SQL statement executed was: UPDATE lime_survey_223698 SET "lastpage"=0, "223698X272X3728SQ001"='0', "223698X272X3732SQ001"='35,232asd' WHERE ID=6

TagsNo tags attached.
Attached Files
Bug heat6
Complete LimeSurvey version number (& build)latest
I will donate to the project if issue is resolvedNo
Browser-
Database type & versionpgsql
Server OS (if known)-
Webserver software & version (if known)-
PHP Version-

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2016-03-22 16:23

administrator   ~36713

Similar problem in 2.06:

Did not save

An unexpected error has occurred and your responses cannot be saved.

Your responses have not been lost and have been emailed to the survey administrator and will be entered into our database at a later point.

DenisChenu

DenisChenu

2016-03-22 17:28

developer   ~36731

Great catch :) (and now i understand why i receive email ...)

Totally right :)

But : attention default answer can be Expression . More simple expression : {TOKEN:FIRTSNAME}

ollehar

ollehar

2016-03-22 17:29

administrator   ~36732

Ah. Then it needs to be evaluated and checked?

DenisChenu

DenisChenu

2016-03-22 18:13

developer   ~36735

Yes, but i think it's in EM : fix it before set in saveValue. I think EM do it always, but seem not ...

DenisChenu

DenisChenu

2016-03-23 08:32

developer   ~36740

@olle :
there are 4 (or more) possible solution , do you had an advice :

  1. Fix only by question type : numerci to number , date to date
    1.1 : fix only for save in DB
    1.2 : fix in DB + in $_SESSION (before question is view)
  2. Fix by EM (for example : if you set maximum to 10, and the default is set to 11
    2.1 : fix only for save in DB
    2.2 : fix in DB + in $_SESSION

The 1.1 is the minimum : fix the SQL only but bad value can be shown to user.
2.2 is the max : but in "mutiple question" i think if one value is bad : all value are not saved.

What do you think of this ?

ollehar

ollehar

2016-03-23 15:31

administrator   ~36742

Hm, I would probably insert fix when the default answer is being saved. Check if question type is numeric - if yes, check if you can parse the value as number. So 1.1.

ollehar

ollehar

2016-03-23 15:37

administrator   ~36745

Well, 2.1 would be nice, too. :P

DenisChenu

DenisChenu

2016-03-23 15:44

developer   ~36746

Then : don't save in DB if "invalid" : like when we click at "NEXT" but set in $_SESSION.

With this method : set in session : VALUE of slider can be A2 for example :)

ollehar

ollehar

2016-03-23 15:51

administrator   ~36747

Wait, no. I'm thinking about the back-end, when saving default value. That's where the check needs to be.

DenisChenu

DenisChenu

2016-03-23 16:22

developer   ~36749

Last edited: 2016-03-23 16:22

No : you can not validate backend : {TOKEN:ATTRIBUTE_1}, {if(1==0,"",212)} etc ....

ollehar

ollehar

2016-03-23 16:37

administrator   ~36750

OK, so only check question type in back-end, then?

DenisChenu

DenisChenu

2016-03-23 16:46

developer   ~36752

????

if numeric : can we accept {TOKEN:ATTRIBUTE_1} ? I don't want to test if it's an expression or not. No ?

DenisChenu

DenisChenu

2016-03-24 12:33

developer   ~36779

OK, must fix exactly at the same way the "User enter something in input", click next.

Then linked with https://bugs.limesurvey.org/view.php?id=10825

DenisChenu

DenisChenu

2016-03-24 15:37

developer   ~36789

Semi fixed with : https://bugs.limesurvey.org/view.php?id=10825 :)

Just like "user submit a bad value"

DenisChenu

DenisChenu

2016-03-25 17:39

developer   ~36812

OK, this one is fixed .

Just like an user set a bad value.

I fix the other : fix in _validateQuestion : if answer type is invalid : leave it in session, but set it to NULL/empty in DB : OK ?

c_schmitz

c_schmitz

2016-04-01 11:36

administrator   ~36886

Version 2.50+ Build 160401 released

Issue History

Date Modified Username Field Change
2016-03-22 16:22 ollehar New Issue
2016-03-22 16:23 ollehar Note Added: 36713
2016-03-22 17:28 DenisChenu Note Added: 36731
2016-03-22 17:28 DenisChenu Assigned To => DenisChenu
2016-03-22 17:28 DenisChenu Status new => assigned
2016-03-22 17:29 ollehar Note Added: 36732
2016-03-22 18:13 DenisChenu Note Added: 36735
2016-03-23 08:32 DenisChenu Note Added: 36740
2016-03-23 15:31 ollehar Note Added: 36742
2016-03-23 15:37 ollehar Note Added: 36745
2016-03-23 15:44 DenisChenu Note Added: 36746
2016-03-23 15:51 ollehar Note Added: 36747
2016-03-23 16:22 DenisChenu Note Added: 36749
2016-03-23 16:22 DenisChenu Note Edited: 36749
2016-03-23 16:37 ollehar Note Added: 36750
2016-03-23 16:46 DenisChenu Note Added: 36752
2016-03-24 12:33 DenisChenu Note Added: 36779
2016-03-24 15:37 DenisChenu Note Added: 36789
2016-03-25 17:38 DenisChenu File Added: Capture du 2016-03-25 17-38-25.png
2016-03-25 17:39 DenisChenu Note Added: 36812
2016-03-25 17:40 DenisChenu Status assigned => resolved
2016-03-25 17:40 DenisChenu Fixed in Version => 2.5
2016-03-25 17:40 DenisChenu Resolution open => fixed
2016-04-01 11:36 c_schmitz Note Added: 36886
2016-04-01 11:36 c_schmitz Status resolved => closed
2019-11-01 17:25 c_schmitz Category Survey design => Survey editing