Actions

QS

Em validation q: Difference between revisions

From LimeSurvey Manual

(Marked this version for translation)
Line 7: Line 7:


<!--T:192-->
<!--T:192-->
<div class="simplebox">Note: This features is available starting in version 1.92</div>
{{FeatureStarting|v=1.92}}


<!--T:193-->
<!--T:193-->
Line 57: Line 57:


<!--T:208-->
<!--T:208-->
<div class="simplebox">Note: Remember, LimeSuvey uses the Perl syntax for regular expressions, so they should start and end with / (slash character)!</div>
{{Hint|Text=Remember, LimeSuvey uses the Perl syntax for regular expressions, so they should start and end with / (slash character)!}}


<!--T:209-->
<!--T:209-->
</onlyinclude>
</onlyinclude>
[[Category:Question Settings]][[Category:Advanced Question Settings]]


</translate>
</translate>

Revision as of 19:22, 12 June 2013


Whole question validation equation (em_validation_q)

 Hint: This features is available starting in version 1.92


Description

This is an equation that is used to validate the entire question (e.g all of its parts collectively for a multi-answer question). If the question fails the validation criteria, then then em_validation_q_tip message has the CSS style .error set to it. This tip uses the .em_q_fn_validation CSS style, which is hidden by default within template.css.

The main difference between this feature and the Sub-question validation equations (em_validation_sq option) is that for this feature, if the question (or question parts) fail validation, then an error message could be shown. For the sub-question validation, each text entry cell (e.g. in array, but also applies to single entry question types) will be styled so that the background color is pink.

Valid values

Example

    • You want to collect demographic information from users via a multiple short text question, and you want to validate that the user has entered a reasonable email and phone number.

This example shows how the question looks with invalid answers:

And here is what it looks like with one invalid answer:

Here is how you edit a question to enter that information:

And here is part of the Show Logic File output that lets you validate the accuracy of your expression and ensure there are no syntax errors:

As you can see, the validation equation tests that both the email and phone are either empty or match a regular expression filter.

The validation tip only shows the warning message if the phone or email appears invalid.

 Hint: Remember, LimeSuvey uses the Perl syntax for regular expressions, so they should start and end with / (slash character)!