Welcome to the LimeSurvey Community Forum

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

Search Results (Searched for: validation)

  • KaryG
  • KaryG's Avatar
17 May 2023 04:49
I've been trying to get the validation to work on this question, but when I use count responses I see unusual results. I share a screenshot where you can see that I have selected only one answer in the entire question, but the count shows 21 answers, row 1 shows 3, and column 4 shows 9. Even weirder is that all the rows and columns also show answers, even if you haven't answered anything.




I think maybe there is something I'm doing wrong or I'm not taking into account.
Attached the survey of the screenshot.
Thank you!

File Attachment:

File Name: limesurvey...5961.lss
File Size:79 KB
  • Joffm
  • Joffm's Avatar
16 May 2023 18:17
Split the question into a question of type array and one of type array(text) with drop-downs.
Merge the questions with css classes "no-question" and "no-bottom"

Use question validation "unique(self)" to avoid identical answers.

Examples of all here in the forum.
I am a bit short of time to create  something.
You should have answered the questions at the beginning and send a lss export of these questions.

Joffm
  • claskowski
  • claskowski's Avatar
15 May 2023 19:24
Replied by claskowski on topic Tableau nombres
re bonjour,
Désolé pour la formulation, ma formule est bien placée dans "équation de validation de la question" et non dans validation de la question en général.
La formule ne fonctionne pas peut être à cause du tableau et des valeurs minimale et maximale que j'ai indiquées.
J'ai choisi ce type de tableau nombre car lors d'un tableau texte lorsqu'on saisi des nombres décimaux, lors de l'export la virgule disparait et les données sont donc fausses.
  • DenisChenu
  • DenisChenu's Avatar
15 May 2023 18:01
Replied by DenisChenu on topic Tableau nombres
Version 2.73 ?

C'est dans équation de validation de la question, en dessous tu as "Astuce pour"

La validation de questions c'est un vieux truc.
  • Joffm
  • Joffm's Avatar
15 May 2023 17:49
You can't set the question to "mandatory".
"Mandatory" means "All cells have to be filled"

Use "question validation".
You have to check that there are exactly three cells filled in each row.

Joffm
 
  • KaryG
  • KaryG's Avatar
15 May 2023 16:14
I am having problems with validation. I can't understand what is wrong. I am attaching a screenshot of the problem and the file of the test survey.


Thank you for all the assistance!
 

File Attachment:

File Name: limesurvey...15-4.lss
File Size:60 KB

 
  • Christophelaskowski
  • Christophelaskowski's Avatar
15 May 2023 15:34
Tableau nombres was created by Christophelaskowski
Bonjour,
j'utilise la version limesurvey 2.73.0+171219

J'ai créé un tableau nombres pour que les répondants puissent indiquer des nombres de jours (qui peuvent être décimaux). J'ai deux colonnes et j'aimerai que la valeur de la colonne 2 ne puisse pas être supérieur à celle de la colonne 1. Il faudrait qu'elle soit inférieure ou égale à la colonne 1.
J'ai essayé cette formule
((q3_A0_B2.NAOK)<=(q3_A0_B1.NAOK)) dans la validation de question mais cela ne fonctionne pas.
Je joins une capture d'écran. 


Je ne suis pas très doué et j'ai essayé avec qcode mais ça bloque aussi.
Est-ce que j'utilise le bon type de question et la bonne formule?
Merci pour votre aide.
Cordialement
Christophe

Aidez-nous à vous aider et remplissez les cases appropriées :

Votre version de LimeSurvey : Version de votre LimeSurvey : [voir en bas à droite de l'écran d'administration de votre LimeSurvey].
Votre propre serveur ou LimeSurvey Cloud :
Thème :

==================
[Écrivez ici votre question/remarque]
  • DenisChenu
  • DenisChenu's Avatar
12 May 2023 09:14
Replied by DenisChenu on topic Input data validation

Please help us help you and fill where relevant:
Your LimeSurvey version: 5.4.11+221114
Own server YES
Survey theme/template: Fruity
==================
How is user-supplied data validated, filtered, or sanitized by the application?
 

You mean data sent by participant ?
If you set validation option : it was validated.

Else !: we don't sanitize or anything else the data. We encode it to enter in database, end show it encoded in admin view.

participant can enter <script>alert('XSS');</script> : we ave this and show this (encoded)
 
  • Jameswalter
  • Jameswalter's Avatar
12 May 2023 07:23
Replied by Jameswalter on topic Input data validation
LimeSurvey is an open-source survey software that allows users to create and conduct online surveys. When users submit data through LimeSurvey, the application follows certain steps to validate, filter, and sanitize the data. Here are some ways LimeSurvey validates and filters user-supplied data:

Data Type Validation: LimeSurvey validates data by ensuring that the data submitted is of the correct data type. For example, if a user is asked to submit a numerical value, LimeSurvey will ensure that the value submitted is a number and not a string.

Range Validation: LimeSurvey can validate data by checking whether the submitted data falls within a specified range. For example, if a user is asked to enter their age, LimeSurvey can validate that the age falls within a specific range, such as 18 to 99 years old.

Required Field Validation: LimeSurvey can also validate data by ensuring that all required fields are filled out before submitting a form. This helps to ensure that important data is not missing.
  • Joffm
  • Joffm's Avatar
11 May 2023 20:08
Either the entire question is mandatory or not.

You have to set it to "not mandatory" and make sure the first rows are filled by validation.

A workaround could be:
Use two questions.
One mandatory for the first rows, one not mandatory for the "other" rows.
Merge the questions with css classes "no-question" and "no-bottom".

Joffm 
  • Joffm
  • Joffm's Avatar
11 May 2023 11:40
Hi,

I need to do something similar

But only at first glance.
The other solution was based on an array
As you can imagine this is quite different as an array allows only one response per row.
But here you expect three responses per row

You may use an array(text) and insert checkboxes.
Then you have to handle that each pair is exclusive.

Here's a script I adapted from a former solution of @tpartner.
Code:
<script type="text/javascript" charset="utf-8">  
    
    $(document).on('ready pjax:scriptcomplete',function(){
 
        // Identify this question
        var thisQuestion = $('#question{QID}');
 
        // Column-specific classes
        $('tr.subquestion-list', thisQuestion).each(function(i) {
            $('th, td', this).each(function(i) {
                $(this).addClass('column-'+i);
            });
        });
        
        // Insert checkboxes
        $('.answer-item.column-2, .answer-item.column-4, .answer-item.column-6', thisQuestion).addClass('custom-checkbox-item');
        $('.custom-checkbox-item', thisQuestion).each(function(i) {
            var thisID = $('input:text:eq(0)', this).attr('id');
            $('label', this).before('<input class="" id="'+thisID+'" value="Y" type="checkbox" name="'+thisID.replace(/answer/, '')+'" />');
            if($('input:text:eq(0)', this).val() == 'Y') {
                $('input:checkbox:eq(0)', this).prop('checked', true);
            }
            $(this).removeClass('text-item').addClass('checkbox-item');
            $('input:text:eq(0)', this).remove();
        });
        
        // Identify exclusive items
        $('.answer-item.column-1, .answer-item.column-2', thisQuestion).addClass('exclusive-item1');
        $('.answer-item.column-3, .answer-item.column-4', thisQuestion).addClass('exclusive-item2');
        $('.answer-item.column-5, .answer-item.column-6', thisQuestion).addClass('exclusive-item3');
        
        // Listeners for exclusive items
        $('.exclusive-item1 input:text', thisQuestion).on('keyup change', function(e) {
            if($.trim($(this).val()) != '') {
                $(this).closest('tr.subquestion-list').find('.exclusive-item1 input:checkbox').prop('checked', false);
            }
        });
        $('.exclusive-item1 input:checkbox', thisQuestion).on('change', function(e) {
            if($(this).is(':checked')) {
                var thisItem = $(this).closest('.answer-item');
                $(this).closest('tr.subquestion-list').find('.exclusive-item1 input:text').val('');
            }
        });
 
        $('.exclusive-item2 input:text', thisQuestion).on('keyup change', function(e) {
            if($.trim($(this).val()) != '') {
                $(this).closest('tr.subquestion-list').find('.exclusive-item2 input:checkbox').prop('checked', false);
            }
        });
        $('.exclusive-item2 input:checkbox', thisQuestion).on('change', function(e) {
            if($(this).is(':checked')) {
                var thisItem = $(this).closest('.answer-item');
                $(this).closest('tr.subquestion-list').find('.exclusive-item2 input:text').val('');
            }
        });
 
        $('.exclusive-item3 input:text', thisQuestion).on('keyup change', function(e) {
            if($.trim($(this).val()) != '') {
                $(this).closest('tr.subquestion-list').find('.exclusive-item3 input:checkbox').prop('checked', false);
            }
        });
        $('.exclusive-item3 input:checkbox', thisQuestion).on('change', function(e) {
            if($(this).is(':checked')) {
                var thisItem = $(this).closest('.answer-item');
                $(this).closest('tr.subquestion-list').find('.exclusive-item3 input:text').val('');
            }
        });
 
    });
</script>

Additionally you may adapt the column width and the background colors
Code:
<script type="text/javascript" charset="utf-8">
  $(document).on('ready pjax:scriptcomplete',function(){
    var thisQuestion = $('#question{QID}');
    // Add a question class
    thisQuestion.addClass('custom-array');
 
    // Column-specific classes
    $('table.subquestion-list tr', thisQuestion).each(function(i) {
      $('th, td', this).each(function(i) {
        $(this).addClass('column-'+i);
      });
    });
  });
</script>
<style type="text/css">.custom-array table.subquestion-list col {
    width: auto !important;
  }
 
  .custom-array table.subquestion-list thead .column-0 {  width: 25%; }
  .custom-array table.subquestion-list thead .column-1 {  width: 15%; }
  .custom-array table.subquestion-list thead .column-2 {  width: 10%; background-color:#efefef; }
  .custom-array table.subquestion-list thead .column-3 {  width: 15%; }
  .custom-array table.subquestion-list thead .column-4 {  width: 10%; background-color:#efefef; }
  .custom-array table.subquestion-list thead .column-5 {  width: 15%; }
  .custom-array table.subquestion-list thead .column-6 {  width: 10%; background-color:#efefef; }

  .custom-array table.subquestion-list td.column-2,
  .custom-array table.subquestion-list td.column-4,
  .custom-array table.subquestion-list td.column-6 {
    background-color:#efefef;
  }
</style>

 

What is left for you?
The validation. That each row contains exactly three responses.

Joffm

 
  • Joffm
  • Joffm's Avatar
10 May 2023 23:25 - 11 May 2023 09:37
Replied by Joffm on topic Two drop down questions next to each other
You only want to have two Drop-downs side by side, one for month, one for year?
There are many options.
1. Array dual scale with drop-down layout
2. Array(text) with drop-downs by javascript.
3. Multiple short text with drop-downs by javascript.
4. Two single questions (drop-down) side by side by flexbox-layout.
5. Two single questions (drop-down) vertically merged by css-classes.
6. And of course a datepicker with the appropriate setting (month.year)
7. One question with input mask and validation by RegExp
​​​​​​
Examples you find here in the forum.

But first answer the questions at the beginning and show how you think it to look like.

Nevertheless in my opinion it is less cumbersome for the respondent to enter just a number instead of clicking to open the drop-down and then click again to select the value.

Joffm 
  • Joffm
  • Joffm's Avatar
09 May 2023 10:36 - 09 May 2023 10:40
Validation equation in the second question
self.NAOK!=Q1.NAOK

Or do not display the chosen answer of Q1 in Q2.

Please explain more detailed, best send a lss export of the relevant questions.

Joffm 
  • toddld
  • toddld's Avatar
08 May 2023 21:33
Input data validation was created by toddld
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.4.11+221114
Own server YES
Survey theme/template: Fruity
==================
How is user-supplied data validated, filtered, or sanitized by the application?
  • Joffm
  • Joffm's Avatar
04 May 2023 12:54
Replied by Joffm on topic Matrix texts -> first line must be entered
Eben, but it's shorter with ".self".

And where are the curly brackets around your validation tip?

And this seems to be really strange "< 3 != 3"

Joffm
Displaying 166 - 180 out of 182 results.

Lime-years ahead

Online-surveys for every purse and purpose