Actions

QS

Em validation sq: Difference between revisions

From LimeSurvey Manual

m (Add link to Expresssion Manager this)
m (Text replacement - " enclose="div"" to "")
 
(2 intermediate revisions by one other user not shown)
Line 16: Line 16:


<!--T:230-->
<!--T:230-->
Any equation that makes use of the [[Expression Manager]] syntax, without surrounding curly braces.
Any equation that makes use of the [[ExpressionScript - Presentation|ExpressionScript]] syntax, without surrounding curly braces.


<!--T:224-->
<!--T:224-->
Line 25: Line 25:


<!--T:227-->
<!--T:227-->
<syntaxhighlight lang="php" enclose="div">(this / 3) == floor(this/3)</syntaxhighlight>
<syntaxhighlight lang="php">(this / 3) == floor(this/3)</syntaxhighlight>


<!--T:228-->
<!--T:228-->
The reserved variable [[Expression_Manager#The_reserved_.27this.27.2C_.27self.27.2C_and_.27that.27_variables|''this'']] is automatically replaced by a reference to the active text entry cell.
The reserved variable [[ExpressionScript - Presentation#The_reserved_.27this.27.2C_.27self.27.2C_and_.27that.27_variables|''this'']] is automatically replaced by a reference to the active text entry cell.


<!--T:229-->
<!--T:229-->

Latest revision as of 15:01, 16 February 2022


Sub-question validation equation (em_validation_sq)

Description

This is an equation that is used to validate each subquestion (text field) individually. Any text field that does not pass these validation conditions will have its background color turned pink (using the .em_sq_fn_validation CSS style) to highlight the error. Note that this is available in addition to the regular expression-based validation option.

Valid values

Any equation that makes use of the ExpressionScript syntax, without surrounding curly braces.

Examples

For example, if you want to allow only numbers that are a multiple of 3 as answers, the equation would be:

(this / 3) == floor(this/3)

The reserved variable this is automatically replaced by a reference to the active text entry cell.