Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Search Results (Searched for: validation)

  • tpartner
  • tpartner's Avatar
27 Mar 2024 18:37
Replied by tpartner on topic mark red just specific cells Array text
It seems to me that according to your mock-up above, the question validation equation should be:

Code:
(
    is_empty(M1_Y001_X003.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y001_X004.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y001_X005.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y001_X006.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y001_X007.NAOK) 
    OR 
    !is_empty(M1_Y001_X001.NAOK)
)
AND
(
    is_empty(M1_Y004_X001.NAOK) 
    OR 
    (
        !is_empty(M1_Y004_X008.NAOK)
        AND
        !is_empty(M1_Y004_X009.NAOK)
        AND
        !is_empty(M1_Y004_X010.NAOK)
    )
)
  • brais24
  • brais24's Avatar
27 Mar 2024 16:21
Replied by brais24 on topic mark red just specific cells Array text
Hi there, i have a little update, i be able to do what i want with 2 of the cells, when i insert a value on the second cell of the first row, an alert popup saying that you have to insert something on the first cell of the first row, like you can see here.
 

And when you insert something on the first cell of the first row, the message dissapear as you can see.
 

I be able to do it using this code on ecuation validation question:
((is_empty(M1_Y001_X003.NAOK)) or (!is_empty(M1_Y001_X003.NAOK) and (!is_empty(M1_Y001_X001.NAOK))))

And this on help about validation question:
{if((((is_empty(M1_Y001_X003.NAOK)) or (!is_empty(M1_Y001_X003.NAOK) and (!is_empty(M1_Y001_X001.NAOK))))), '', 'Por favor, introduzca algo en gasto total M1.<br />')}

Now i have to do the same with the other 4 cells on the same row, and then do the same but in other way, if you insert a value on the first cell, should appear a message saying that you have to insert a value on the last 3 cells.

¿Can someone help me to do this?

I try to add the 3rd cell (Wich is the 4th by code) with this on validation question and help about validation question, but dont work, I think it's because of the nested validations.

(((is_empty(M1_Y001_X003.NAOK)) or (is_empty(M1_Y001_X004.NAOK))) or ((!is_empty(M1_Y001_X003.NAOK) or !is_empty(M1_Y001_X004.NAOK)) and (!is_empty(M1_Y001_X001.NAOK))))

{if(((((is_empty(M1_Y001_X003.NAOK)) or (is_empty(M1_Y001_X004.NAOK))) or 
((!is_empty(M1_Y001_X003.NAOK) or !is_empty(M1_Y001_X004.NAOK)) and (!is_empty(M1_Y001_X001.NAOK))))), '', 'Por favor, introduzca algo en descripción de los programas.<br />')}

I attach the lss again with the code too.
 

File Attachment:

File Name: limesurvey...3-27.lss
File Size:40 KB


In advance, thanks for the help.
  • DenisChenu
  • DenisChenu's Avatar
14 Mar 2024 15:54
Replied by DenisChenu on topic Equals sum value over 2 separate questions?

If Q2 is a multi-numeric, I think its validation equation should be:

 
Yes ! You're right !
 
  • tpartner
  • tpartner's Avatar
14 Mar 2024 14:04 - 14 Mar 2024 14:08
Replied by tpartner on topic Equals sum value over 2 separate questions?
If Q2 is a multi-numeric, I think its validation equation should be:

Code:
sum(Q1, self) <= 100

Or:

Code:
sum(Q1, that.Q2) <= 100
  • DenisChenu
  • DenisChenu's Avatar
14 Mar 2024 12:24
Replied by DenisChenu on topic Equals sum value over 2 separate questions?
  • tpartner
  • tpartner's Avatar
12 Mar 2024 19:58
1) Assign the map question a CSS class "custom-hidden".

2) Place this script in the source of the checkbox question:

Code:
$(document).on('ready pjax:scriptcomplete',function(){
 
        // Identify some elements
        var thisQuestion = $('#question{QID}');
        var mapCheckbox = $(':checkbox:last', thisQuestion);
        var mapQuestion = $(thisQuestion).nextAll('.text-short:eq(0)');
 
        // Listener on the checkbox
        $(mapCheckbox).on('change', function(e) {
            handleMap();
        });
 
        // Initial state
        handleMap();
 
        // Function to handle the map visibility
        function handleMap() {
 
            if($(mapCheckbox).is(':checked')) {
                $(mapQuestion).removeClass('custom-hidden');
            }
            else {
                $(mapQuestion).addClass('custom-hidden');
            }
        };
 
    });
</script>

3) Place this CSS in the source of the checkbox question:

Code:
<style type="text/css" data-author="Tony Partner">
 
    .custom-hidden {
        position: absolute;
        left: -9999em;
    }
</style>

4) Modify the checkbox question validation to enforce a map selection if the second checkbox is selected (I left this for you to do).

Sample survey attached: 

File Attachment:

File Name: limesurvey...4971.lss
File Size:34 KB
  • Joffm
  • Joffm's Avatar
04 Mar 2024 17:08
Though I am not addressed, here an answer.
Yes, it's easy
Code:
<link href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" rel="stylesheet" />
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/1.0.11/jquery.csv.min.js">
 
</script><script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:complete',function() {
    var url = "/lime6/upload/surveys/{SID}/files/namen.csv";
 
    var Names = new Array();
 
    $.get(url,function(data){
      fullArray = $.csv.toArrays(data);
      $(fullArray).each(function(i, item){
        Names.push(item[0]);
      });
      $('#question{QID} .answer-item:nth-child(2) input[type="text"]').autocomplete({
        minLength: 2,
        source: Names
      });
    });
  });
</script>
Here the names are in a csv-file.
But you also may use an array.





There is a better (javascript) solution to avoid duiplicates than the simple validation.
Of course, Tony provided it a few years ago, but only for "multiple short text"

Joffm
 
  • yuto0419
  • yuto0419's Avatar
29 Feb 2024 01:37
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.9+230306
Own server or LimeSurvey hosting:Own server(Azure)
Survey theme/template:fruity
==================
There is a way to insert the thousands separator (comma)?

I'm trying to create an array type question that inputs an amount.
If Question types is set to Array (Numbers), a validation error will occur if a comma is entered.
Array (Texts) allows you to enter a comma, but the comma will also be reflected in the answer.

Is there a way to make the digit separator appear in the display, but not reflect it in the answer?
Also, is there a function that automatically separates the digits when I enter a number?

Thanks!
  • Joffm
  • Joffm's Avatar
23 Feb 2024 16:31
Easy to understand.

You used "no-question".
So this is hidden.
Reason: If you use these css classes you want to merge the questions and display an error in the first question by validation.

Without "no-question" everything is fine.
 

And you may remove this small horizontal line by adding this to the question text
Code:
<style type="text/css">
#question{QID}.question-container {
    border-top: 0; 
}
</style>


Und warum muss ich jetzt Englisch schreiben?

Joffm
  • VictorROYER
  • VictorROYER's Avatar
19 Feb 2024 16:06
Je viens de comprendre mon problème.
Déjà, l'utilisation de em_validation_q_tip est en effet la meilleure solution pour régler mon problème. j'ai fait un test avec le fichier lss de TMSWhite dans cet exemple :
forums.limesurvey.org/forum/can-i-do-thi...alidate-subquestions

Cependant, le message d'erreur apparaît dans le code html quand je fais inspecter, mais pas sur mon écran ( pas de message ni de contour rouge pour me signaler une erreur)
 

La structure de mon enquête créer peut-être cette erreur :
J'ai un groupe avec 2 questions, la première question Q1 permet d'afficher mon tableau avec mes boutons et la question Q2 me permet de créer mes entrées utilisateurs.

D'ailleurs, je remarque que le nom de ma question Q2 n'apparaît aussi pas sur mon enquête, mais est bien présent dans mon code html.
Il s'agit presque d'un autre problème, l'indication de validation de la question Q2 n'apparaît pas s'il y a plusieurs questions dans le groupe.
Dois-je créer un nouveau topic ?
  • malmaz
  • malmaz's Avatar
19 Feb 2024 12:10
Hello,

Thank you for your reply. I need some assistance with where to input a specific condition within the LimeSurvey settings. I navigated to Settings -> Logic -> Filter and pasted the following code:

Q2_SQ001: Q1_SQ001<4; Q2_SQ002: Q1_SQ002<4


However, it does not seem to work. I also tried using the "Sub-question validation equation" option. The question codes and sub-question codes do match. Could you guide me on what might be going wrong or if there's a specific place in the settings I need to input this condition to make it work?
  • DenisChenu
  • DenisChenu's Avatar
19 Feb 2024 10:28
Ah oui, multiple zone de text court.
Sinon : à la base je donne des exemples, pas toujours des solutions.

Bon, tu le fait vie n regexp : alors le gmail.com , à mon avis tu le supprime.

Et pour faire la regexp : le mieux est d'abord de le faire dans l'aide pour pas se tromper :)

mais sinon : le plus simple : manual.limesurvey.org/Expression_Manager#Access_to_Functions :strpos

strpos(Q2_2.NAOK,"@") dans Question validation equation (em_validation_q)
et {if(!strpos(Q2_2.NAOK,"@"),'Vous devez inscrire une adresse de messagerie valide')} dans Tip for whole question validation equation (em_validation_q_tip)

 

 
  • DenisChenu
  • DenisChenu's Avatar
19 Feb 2024 09:43
C'est à mettre dans la partie astuce : Tip for sub-question validation equation (em_validation_sq_tip)

Et tu met le contrôle dans la partie validation

Par exemple validation

!is_empty(Q2_SX01_SY0.NAOK) and !is_empty(Q2_SX02_SY0.NAOK) and
!is_empty(Q2_SX03_SY0.NAOK)

Mais attention : tu dois AUSSI modifier les codes des sous-questions : je ne peux pas les connaître pour toi : manual.limesurvey.org/Expression_Manager#Qcode_Variable_Naming
  • VictorROYER
  • VictorROYER's Avatar
19 Feb 2024 09:19 - 19 Feb 2024 09:51
Bonjour Denis,

Merci pour ta réponse, je n'ai malheureusement pas réussi à faire fonctionner la validation manuelle de la question.

J'ai vu que quand tu édites une question, tu as 2 sections :

- Équation de validation de question
- Équation de validation des sous-questions

J'ai essayer de faire un test avec ton exemple dans ces 2 sections (en replaçant Q0 par Q2 car l'ID de ma question est Q2)

J'ai essayé avec ces 2 sections et j'ai le même message d'erreurs :

J'ai le message d'erreur : One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid.

Voici ma configuration :
 

J'ai aussi essayer avec cette configuration, mais j'ai toujours le même message d'erreur
 

Hésite pas si tu veux plus de renseignements,

Cordialement,
Victor ROYER
  • DenisChenu
  • DenisChenu's Avatar
16 Feb 2024 09:43
Utiliser la validation manuelle de question : manual.limesurvey.org/Question_type_-_Ar..._validation_q_tip.29

Et donc écrire le texte en fonction (je le fait pour vide, ca va plus vite, et c'est pour l'exemple.

{if(is_empty(Q0_SX01_SY0.NAOK),"La valeur en X1, Y1 est obligatoire.")}
{if(is_empty(Q0_SX02_SY0.NAOK),"La valeur en X2, Y1 est obligatoire.")}
{if(is_empty(Q0_SX03_SY0.NAOK),"La valeur en X3, Y1 est obligatoire.")}
Displaying 16 - 30 out of 182 results.

Lime-years ahead

Online-surveys for every purse and purpose