Actions

Upgrade hints for version 1.92

From LimeSurvey Manual

Other languages:
English • ‎français • ‎Nederlands • ‎português do Brasil • ‎русский • ‎slovenščina


Features acting different in 1.92

Mathematical comparisons against empty/no responses

If you have any of the following conditions, they will not work as expected:

  1. (var == 0)
  2. (var != 0)
  3. (var <= 0)
  4. (var >= 0)
  5. (var < x)
  6. (var <= x)

The root problem is that JavaScript and PHP both treat a non-response ("") as 0 in mathematical comparisons, so although ("" == 0) should be false, JavaScript and PHP treat it as true.  This is especially problematic for conditions like (AGE < 16), which should be false until AGE is answered.

How to fix this problem if you only use the Conditions Editor

As of Version 1.92+ release 120605, this has been fixed if you exclusively use the Conditions editor.  However, you may need to upgrade the conditions in your database once.  This can be done via the command:

http://localhost/limesurvey/admin/admin.php?action=EMtest&subaction;=upgrade_conditions2relevance

You can also do this upgrade from the administration console:

Pick any survey so that you can access the EM test suite:

Launch em.jpg

Click on Bulk Convert Conditions to Relevance:

Bulk-convert-conditions.jpg

If it is successful, you will see a page like this:

Bulk-convert-conditions-output.jpg

If you are testing out the 2.0 release candidate, it has also been patched.  To upgrade existing conditions in a 2.0 installation, use this command:

http://localhost/limesurvey_yii/index.php/admin/expressions/upgrade_conditions2relevance

How to fix this problem is you manually enter Relevance equations

In this case, you need to be aware of the unexpected behavior and adjust your equations appropriately.  This table shows the needed conversions.  If you want to accomplish the "Desired Comparison", you need to enter the equation in the "Needed Equation" column

Desired Comparison Needed Equation
(var == '0') !is_empty(var) and (var == '0')
(var != '0') is_empty(var) or (var != '0')
(var <= '0') !is_empty(var) and (var <= '0')
(var >= '0') !is_empty(var) and (var >= '0')
(var == x) !is_empty(var) and (var == x)
(var != x) is_empty(var) or (var != x)
(var < x) !is_empty(var) and (var < x)
(var <= x) !is_empty(var) and (var <= x)
(var >= x) !is_empty(var) and (var >= x)

This figure shows that those equations work as desired.  Green fields show that the PHP and JavaScript versions of the equations generated the proper result.  You can see a few red fields, which show that that variant of the equation did not generated the desired result.

Emptymath5.jpg

To give you a sense of how significant the problem is, and why it is critical to pay attention to those equations, the following images show you how often you get the wrong value if you don't add the is_empty() checks.  Note that PHP and JavaScript aren't even consistently right or wrong.

Emptymath1.jpg

Emptymath2.jpg

Display of conditions

In earlier version the list of conditionally related questions is shown in the following. In 1.92, the new approach is shown after '=>' for each entry

  • Question view => now shows syntax-highligted relevance equation
  • Question re-order view => now shows syntax-highligted relevance equation
  • Group re-order view => now shows syntax-highligted relevance equation (but only at group-level)
  • Printable Survey => now shows relevance and validation equations
  • Data Entry => now shows relevance and validation equations

Features present in earlier versions but missing now

Advanced question settings that work different than in earlier versions

  1. Assessment value
  • The value is currently ignored for the Multiple choice question type

Custom JavaScript usage

You will need to check your custom JavaScript code for two things:

  1. All opening curly braces must have a whitespace (a space, tab, or newline) after them, and all closing curly braces must have whitespace before them (otherwise Expression Manager will think that your JavaSript code should be parsed as an Expression, and it will say that your variables are not defined.
  2. If you do any regular expression parsing within JavaScript, and your regular expressions use curly braces (like us_phone.match(/\d{3}-\d{3}-\d{4}/)), you can not use the in-line regular expression syntax. You must create a a new RegExp() object like this RegExp('/\d{3}-\d{3}-\d{4}/') and use it in the matching, otherwise expression manager will think that you are trying to evaluate {3}

New CSS styles in templates.css

In order to support dynamic display of warning and error messages, new CSS style were added to provide more granular control of the generated tip messages.  These include separable control of tips for number of answers, value ranges, the the like.  Existing templates may need to be modified to enable this granular control, otherwise the advanced option hide_tip may not work.  Here is the new CSS code.

/* Tips / Validation Messages */
/* If the question is invalid, but has not been submitted, give it a pleasant warning color */
div.em_num_answers.good {
color: green;
}
div.em_num_answers.error {
 color: #FF00FF;
 display: block;
}
div.em_value_range.good {
 color: green;
}
div.em_value_range.error {
 color: #FF00FF;
 display: block;
}
div.em_sum_range.good {
 color: green;
}
div.em_sum_range.error {
 color: #FF00FF;
 display: block;
}
div.em_regex_validation {
 display: none;
}
div.em_regex_validation.good {
 color: green;
}
div.em_regex_validation.error {
 color: #FF00FF;
}
div.em_q_fn_validation.good {
 color: green;
}
div.em_q_fn_validation.error {
 color: #FF00FF;
}
div.em_sq_fn_validation.good {
 color: green;
}
div.em_sq_fn_validation.error {
 color: #FF00FF;
}
div.em_other_comment_mandatory.good {
 display: none;
}
div.em_other_comment_mandatory.error {
 color: #FF00FF;
 display: block;
}
input.em_sq_validation.good, textarea.em_sq_validation.good {
}
input.em_sq_validation.error, textarea.em_sq_validation.error {
 color: black;
 background-color:  pink;
}
span.dynamic_sum {
 font-weight: bold;
 background-color: #d3d3d3;
}
span.dynamic_sum.good {
 color: green;
}
span.dynamic_sum.error {
 color: red;
}
span.dynamic_remaining {
 font-weight: bold;
 background-color: #d3d3d3;
}
span.dyanamic_remaining.good {
 color: green;
}
span.dynamic_remaining.error {
 color: red;
}
/* If  it is still invalid after submit, flag it in red */
.input-error div.error {
 color: red;
 display: block;
}
span.hide-tip div.good {
   display: none;
}
span.hide-tip div.error {
   color: #FF00FF;
}
.input-error span.hide-tip div.error {
   color: red;
   display: block;
}