Welcome to the LimeSurvey Community Forum

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

Search Results (Searched for: validation)

  • AntPIC
  • AntPIC's Avatar
Today 13:41
Versione 3.28.76Hi, I'm looking for an expression for validating a multiple entry numeric response (attached).
The response is validated if:
1. both boxes are empty;
2. if at least one of the two is full with a maximum length of 4 numeric digits
These two work
But I would need to enter a third option:
3. i.e. if both are filled in then the first value inserted must be lower than the second.
Here is the expression I am using (the bold part works but the second one doesn't)(is_empty(D1a3_SQ001.NAOK) OR strlen(D1a3_SQ001.NAOK) == 4) AND (is_empty(D1a3_SQ002.NAOK) OR strlen(D1a3_SQ002.NAOK) == 4) OR (!is_empty(D1a3_SQ001.NAOK) AND !is_empty(D1a3_SQ002.NAOK) AND D1a3_SQ002>=D1a3_SQ001)how can I solve it
  • MarkPkilop
  • MarkPkilop's Avatar
12 Apr 2024 12:57
Intergrating MailTester Ninja API was created by MarkPkilop
I would like all email addresses to be validated with an email address verifier such as [url] mailtester.ninja [/url]

This way I am sure about the seriousness of the survey as it has been checked as a correct email address

I know they are having an API maybe could it be used for such a validation
  • brais24
  • brais24's Avatar
03 Apr 2024 12:57
Replied by brais24 on topic mark red just specific cells Array text
Seems like it works, i have to modify a little bit with the ANDS and ORS but it works, i let the code over here.

Ecuation validation question:
(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_Y001_X001.NAOK)OR(!is_empty(M1_Y001_X008.NAOK)OR!is_empty(M1_Y001_X009.NAOK)OR!is_empty(M1_Y001_X010.NAOK)))

Help about validation question:
{if(((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))), '', 'Por favor, introduzca algo en gasto total M1.<br />')}


{if(((is_empty(M1_Y001_X001.NAOK)OR(!is_empty(M1_Y001_X008.NAOK)OR!is_empty(M1_Y001_X009.NAOK)OR!is_empty(M1_Y001_X010.NAOK)))), '', 'Por favor, introduzca Entradas/salidas/stock.<br />')}

I have 2 sentences on the ecuation validation question because i want a different message if you put a value in one cell or in another.

If i have more issues or other this to add i let you know.

Thanks for the help.
  • DenisChenu
  • DenisChenu's Avatar
01 Apr 2024 11:23
Replied by DenisChenu on topic Comment obtenir un code iframe d'une enquête ?
C'est plus ou moins compliqué, mais c'est faisable

Le lien : c'est le lien de l'enquête, ensuite
<iframe src=" limesurvey.example.org/12345 ">

Mais
manual.limesurvey.org/Global_settings#Security
manual.limesurvey.org/Optional_settings/....28New_in_3.24.3_.29

Si tu ne peux pas les placer sur le même domaine principale (intégrer survey.example.org sans www.example.org ) : c'est relativement dangereux (XSS plus facile)!
  • 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?
Displaying 1 - 15 out of 175 results.

Lime-years ahead

Online-surveys for every purse and purpose