View Issue Details

This bug affects 1 person(s).
 14
IDProjectCategoryView StatusLast Update
05762Bug reportsSurvey takingpublic2012-05-28 15:12
ReporterDenisChenu Assigned ToDenisChenu  
PrioritylowSeverityminor 
Status closedResolutionfixed 
Product Version1.92RC3 
Fixed in Version2.00RC2 
Summary05762: Difference betwwen good and not-applicable
Description
  1. When you create a non-mandatory question with min-value, the em_value_range get a .good class.

But if you put 0 : error class.

I think a not-mandatory with empty value don't have to have .good class but stay clean of class.

  1. When you create a mandatory question with min-value, the em_value_range get a .good class. ( then it's green) : respondant can't understand.
    If there are no class ( or a .empty class), it make more easy to manipulate css.
Steps To Reproduce

Import joined survey and see in action.

Additional Information

With an empty class:

.mandatory .empty{color:red}
.empty{color:grey}
.good{color:green}
.error{color:red}

Actually, we can have differencation betwenn.

Maybe all em_value hav to have a common class too ;).

TagsNo tags attached.
Attached Files
Bug heat14
Complete LimeSurvey version number (& build)12363
I will donate to the project if issue is resolvedNo
BrowserFF
Database type & versionnot relevant
Server OS (if known)not relevant
Webserver software & version (if known)not relevant
PHP Versionnot relevant

Relationships

has duplicate 06080 closedDenisChenu Wrong validation for multiple numeric questions 

Users monitoring this issue

There are no users monitoring this issue.

Activities

TMSWhite

TMSWhite

2012-02-06 17:12

reporter   ~17256

That's a good idea, but there is one problem.

The validation rules state that if you have min/max values, and the question is n on-mandatory, then a blank value is OK (good). This may seem non-intuitive, but that is the way the validations work in 1.91 too (they just don't show color-coding).

I guess an alternate process would be to do a two step validation:

if (empty) { / set to now class / }
else if (passes validation) { / set to .good class / }
else { / set to .error class /

DenisChenu

DenisChenu

2012-02-06 17:15

developer   ~17257

Last edited: 2012-02-06 17:20

<q>The validation rules state that if you have min/max values, and the question is n on-mandatory, then a blank value is OK (good).</q>
Then there are problem with mandatory ( check at the second question in exemple: mandatory but good class on em_value).

I think the best way is an .empty class:
if (empty) { .removeClass('error good).addClass('empty') }
else if (passes validation) { .removeClass('error empty).addClass('good') }
else { .removeClass('good empty).addClass('error') }

:)

PS: in 1.91: all validation are made in PHP, and if validation don't work : input-error

PS2: it's important to have good/error/empty for each em_validation because if we hav 2 the one can be red and another green ( can't use .input-error .good{color:red;} )

TMSWhite

TMSWhite

2012-02-06 17:46

reporter   ~17261

I like the idea of two-step validation, but it will require 4-8 hours worth of refactoring and re-validation, so not sure if can get to it before 1.92 RC4

I don't understand PS2. Currently, you can do the following for each em_validation type:

(1) .error {color:purple} // errors when you first see them - before submitting with error
(2) .good (color:green}
(3) .hide-tip .good { display: none } // hide the tip if no problem
(4) .hide-tip .error { } // show the tip in appropriate color if there is error
(5) .input-error .error {color:red} // so visible and red if submit an invalid answer

Through inheritance (e.g. you don't need to explicitly put these), you get
(6) .input-error .hide-tip .good { display:none } // so continue to hide if good
(7) .input-error .good { color:green } // so still green if OK even if input-error in rest of question.

DenisChenu

DenisChenu

2012-02-06 17:54

developer   ~17262

Last edited: 2012-02-06 17:55

(7) .input-error .good { color:green } // so still green if OK even if input-error in rest of question.

Yep, but actually , we have .good on error tip ( i think)

Look at the second question of http://ls-dev.sondages.pro/index.php?sid=76597&amp;newtest=Y&amp;lang=fr the we can't take
.mandatory .good{color:green}

It's why i think a .empty class are the best.

( for 1.92 RC4, no problem even if it's for 1.92 release 2000, i know i can't make modification directly, maybe look for some patch ;), i put low on priority).

TMSWhite

TMSWhite

2012-02-06 18:03

reporter   ~17263

Yes, there is .input-error .good there, since you can a whole question fail at least one validation rule (so gets .input-error), but not fail all of the rules.

So, in your example, it fails the mandatory rule, but not the validation rules (which currently allow blank values).

I think you've hit on a different issue. Right now, most validations let you keep the answer blank; and mandatory is handled separately. Perhaps they should be handled together, so only consider a blank value OK if the question is non-mandatory.

We should probably discuss, as a team, the full set of different styles we'd want for +/- mandatory, +/- empty, +/- any em_validation +/- input-error +/- fails validation rule to be sure we've covered all the desired possibilities.

All the more reason to hold off on this for now rather than rush it into RC4.

TMSWhite

TMSWhite

2012-02-17 18:53

reporter   ~17496

Is this still a problem?

DenisChenu

DenisChenu

2012-02-17 19:13

developer   ~17498

I think there are a difference between NA/empty and error.

Allowing blank value aren't a Validation succes, it's an Validation not-applicable

:)

I don't make test with different combination, but allways think best way are a good way.

TMSWhite

TMSWhite

2012-02-17 23:53

reporter   ~17502

Note to self. To make this work:

if (empty) { .removeClass('error good').addClass('empty'); }
else if (passes validation) { .removeClass('error empty').addClass('good'); }
else { .removeClass('good empty').addClass('error'); }

However, to do if(empty), need to refactor EM-generated validation JavaScript. Currently, validations are like if(empty(x) || x <= 5); and those are concatenated . Would need to split apart empty tests and validity tests for each question attribute, then do the same in GenerateRelevanceAndTailoringJavaScript()

Also requires tweak of _ValidateQuestion to do same logic (to ensure that isempty() and regular validations are both done to confirm that submitted data is accurate). - so update of qstatus to add 'isemptyJS'

DenisChenu

DenisChenu

2012-02-18 01:04

developer   ~17503

I had 2 idea.

Add 3 javascript function for em_validation:
addValidationEmpty
addValidationSuccess
addValidationError

And make something like that:
if (empty) { $(this).addValidationEmpty(); }
else if (passes validation) { $(this).addValidationSuccess(); }
else { $(this).addValidationError(); }

But you can put this "bug" in developpment and assign to me.

Or maybe i had to put a new bug/developpment, test this one, and if class is good: close this one.

For input.text, isempty is easy
For radio-list (in Yii actually) :, $(#questionID .radio-list .radio-item:not(noanser-item)).leght() == 0

But #questionID aren't good for array for exemple.

I have an idea for that : send it to mailing list:
The idea

Put #questionSubQuestionID to all SubQuestion, i think after it's more easy to manage EM-validation by subQuesqtion: code is the same.

Problem : actually we have some javaConditionsSubID: we have to replace with questionSubID in HTML AND in javascript.

I think it can be cool to have:

#questionQuestionID and in database surveyIDXgroupISXQuestionID, the we can allways split SESSION var to work on #questionQuestionID

What do you think of this ?

TMSWhite

TMSWhite

2012-02-18 02:53

reporter   ~17506

Denis-

Thanks for the ideas. However, the hard part is refactoring EM to generate the

if(empty) { }
else if (passes validation) { }
else { }

parts. Once they are in place, adding/removing classes is really easy.

Also, there is so much interaction between relevance, hidden, validity, and mandatory status

So, why don't you give me a few days to see if I can tackle this. If not, I can guide you as to what needs to be re-factored in EM to make it work.

TMSWhite

TMSWhite

2012-02-18 03:57

reporter   ~17507

I'll work first on updating the in-line and wiki documentation for developers to clarify the architectural design and goals of EM.

Although I know we are a community and should be allowed to do things our own way, EM was designed with a specific approach in mind that, if followed, should make it much easier to extend and maintain.

DenisChenu

DenisChenu

2012-03-06 04:21

developer   ~17742

I commit a fix for citronade:
function addClassEmpty(){
$('.answers-wrapper input.text[value=""]').addClass('empty');
$('.answers-wrapper input[type=text][value=""]').addClass('empty');
$('.answers-wrapper textarea').each(function(index) {
if ($(this).val() == ""){
$(this).addClass('empty');
}
});

$(&quot;input.text,input[type=text]&quot;).live(&quot;blur&quot;, function(){
  if ($(this).val() == &quot;&quot;){
    $(this).addClass('empty');
  }else{
    $(this).removeClass('empty');
  }
});
$(&quot;textarea&quot;).live(&quot;blur&quot;, function(){
  if ($(this).val() == &quot;&quot;){
    $(this).addClass('empty');
  }else{
    $(this).removeClass('empty');
  }
});

}

Seems to work .

( I like external JS function, more easy to fix and replace).

TMSWhite

TMSWhite

2012-03-06 04:35

reporter   ~17743

Denis-

That does seem like a reasonable solution. And, it doesn't require any EM changes.

So, we could keep the EM logic intact (which does this):

if (passes validation) { .removeClass('error').addClass('good'); }
else { .removeClass('good').addClass('error'); }

And your function would add/remote .empty

And template.css could be updated to always show default text style if .empty is present.

So, handing this one over to you...

/Tom

DenisChenu

DenisChenu

2012-03-06 11:38

developer   ~17744

For 2.0 or 1.92 ?

c_schmitz

c_schmitz

2012-03-11 21:36

administrator   ~17884

2.0 please.

DenisChenu

DenisChenu

2012-05-11 11:48

developer   ~18694

http://git.io/01VaFg

Put on a new feature

For difference between good and not-applicable: better to use directly EM.
See http://bugs.limesurvey.org/view.php?id=6080 for example.

c_schmitz

c_schmitz

2012-05-28 15:12

administrator   ~18961

Version 2.00RC2 released.

Issue History

Date Modified Username Field Change
2012-02-06 17:01 DenisChenu New Issue
2012-02-06 17:01 DenisChenu File Added: limesurvey_survey_76597.lss
2012-02-06 17:12 TMSWhite Note Added: 17256
2012-02-06 17:15 DenisChenu Note Added: 17257
2012-02-06 17:20 DenisChenu Note Edited: 17257
2012-02-06 17:46 TMSWhite Note Added: 17261
2012-02-06 17:54 DenisChenu Note Added: 17262
2012-02-06 17:55 DenisChenu Note Edited: 17262
2012-02-06 18:03 TMSWhite Note Added: 17263
2012-02-07 12:12 c_schmitz Assigned To => TMSWhite
2012-02-07 12:12 c_schmitz Status new => assigned
2012-02-17 18:53 TMSWhite Note Added: 17496
2012-02-17 19:13 DenisChenu Note Added: 17498
2012-02-17 23:53 TMSWhite Note Added: 17502
2012-02-18 01:04 DenisChenu Note Added: 17503
2012-02-18 02:53 TMSWhite Note Added: 17506
2012-02-18 03:57 TMSWhite Note Added: 17507
2012-03-06 04:21 DenisChenu Note Added: 17742
2012-03-06 04:35 TMSWhite Note Added: 17743
2012-03-06 04:35 TMSWhite Assigned To TMSWhite => DenisChenu
2012-03-06 11:38 DenisChenu Note Added: 17744
2012-03-11 21:36 c_schmitz Note Added: 17884
2012-05-10 20:12 TMSWhite Relationship added has duplicate 06080
2012-05-11 11:48 DenisChenu Note Added: 18694
2012-05-11 11:48 DenisChenu Status assigned => resolved
2012-05-11 11:48 DenisChenu Fixed in Version => 2.00RC2
2012-05-11 11:48 DenisChenu Resolution open => fixed
2012-05-28 15:12 c_schmitz Note Added: 18961
2012-05-28 15:12 c_schmitz Status resolved => closed