Actions

QS

QS:Em validazione q

From LimeSurvey Manual

Revision as of 06:56, 16 August 2023 by Maren.fritz (talk | contribs) (Created page with "*Vuoi raccogliere informazioni demografiche dagli utenti tramite una breve domanda multipla e vuoi confermare che l'utente ha inserito un indirizzo email e un numero di telefo...")


Equazione di convalida della domanda (em_validation_q)

Descrizione

Questa è un'equazione che viene utilizzata per convalidare l'intera domanda (ad esempio, tutte le sue parti collettivamente per una domanda a risposta multipla). Se la domanda non soddisfa i criteri di convalida, verrà visualizzato il messaggio em_validation_q_tip (utilizza lo stile CSS .error). Questo suggerimento utilizza lo stile CSS .em_q_fn_validation, che è nascosto per impostazione predefinita all'interno di template.css.

La differenza principale tra questa funzione e le equazioni di convalida della sottodomanda (em_validation_sq option) è che per questa funzione, se la domanda (o le parti della domanda) falliscono la convalida, potrebbe essere visualizzato un messaggio di errore. Per la convalida della sottodomanda, ogni cella di immissione di testo (ad esempio, in un tipo di domanda array, ma può anche essere applicata a tipi di domanda a immissione singola) verrà disegnata in modo che il colore di sfondo sia rosso (chiaro).

Valori validi

  • Qualsiasi equazione che utilizza la sintassi ExpressionScript, senza parentesi graffe.

Esempio

  • Vuoi raccogliere informazioni demografiche dagli utenti tramite una breve domanda multipla e vuoi confermare che l'utente ha inserito un indirizzo email e un numero di telefono validi.

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)!


Another slightly different example can be downloaded below. It states that none of the three subquestion fields can be empty at the same time and that at least one of them has to be filled in (according to its corresponding regular expression). Download the question from here.