x

Capítulos principales

  1. LimeSurvey Cloud frente a LimeSurvey CE
  2. LimeSurvey Cloud - Guía de inicio rápido
  3. LimeSurvey CE - Instalación
  4. Cómo diseñar una buena encuesta (Guía)
  5. Empezando
  6. Configuración de LimeSurvey
  7. Introducción - Encuestas
  8. Ver la configuración de la encuesta
  9. Ver menú de encuesta
  10. Ver estructura de la encuesta
  11. Introducción - Preguntas
  12. Introducción - Grupos de preguntas
  13. Introducción - Encuestas - Gestión
  14. Opciones de la barra de herramientas de la encuesta
  15. Encuesta multilingüe
  16. Guía de inicio rápido - ExpressionScript
  17. Características avanzadas
  18. Preguntas frecuentes generales
  19. Solución de problemas
  20. Soluciones alternativas
  21. Licencia
  22. Registro de cambios de versión
  23. Complementos - Avanzado
 Actions

Translations

Translations:Question type - Date/29/es

From LimeSurvey Manual


Question validation equation (em_validation_q)

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 em_validation_q_tip message will be displayed (it uses the CSS style .error). 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 subquestion 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 subquestion validation, each text entry cell (e.g., in an array question type, but it can also be applied to single entry question types) will be styled so that the background color is (light) red.

Valid values

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

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 valid email address 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 check the accuracy of your expression and ensure that there are no syntax errors:

As you can see, the validation equation tests that both the email and phone number 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: In order to create complex validation messages, read about the usage of the ExpressionScript.


If you wish to import the example from above into your LimeSurvey installation, download the following .lsq file: Em_validation_q_example.zip.

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