Welcome to the LimeSurvey Community Forum

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

Search Results (Searched for: validation)

  • dangerdangerhighvoltage
  • dangerdangerhighvoltage's Avatar
09 Oct 2023 10:42
Replied by dangerdangerhighvoltage on topic Multiple Choice with comments - sum validation problems
>No need to use the regex, as you calculate a sum (why did you allow numbers up to 10000?)

Because my attempt at making this work was a Frankenstein creation of different google searches without understanding regex at all. :P


Thanks a lot!
  • tpartner
  • tpartner's Avatar
07 Oct 2023 12:23
Replied by tpartner on topic array with one subquestion not mandatory
Question validation equation:

Code:
!is_empty(qCode_SQ001) 
AND 
!is_empty(qCode_SQ002) 
AND 
!is_empty(qCode_SQ003) 
AND 
!is_empty(qCode_SQ004) 
AND 
!is_empty(qCode_SQ005)
AND 
!is_empty(qCode_SQ006)
AND 
!is_empty(qCode_SQ007)
  • Joffm
  • Joffm's Avatar
06 Oct 2023 14:12
Hi,
You can do this
No need to use the regex, as you calculate a sum (why did you allow numbers up to 10000?)

((f10b_1.NAOK!='Y' and f10b_2.NAOK!='Y') or (sum(f10b_1comment.NAOK,f10b_2comment.NAOK)==100)) or (f10b_3.NAOK=='Y' or f10b_4.NAOK=='Y')

To avoid an initial error - as long as no checkbox is selected - the first part.
So, either both checkboxes are not selected or the sum is 100 - or one of the last two checkboxes is selected. 

And a validation tip like
{if(f10b_3.NAOK=="Y" or f10b_4.NAOK=="Y","","Nur Zahlen und Summe muss 100 ergeben!")}
 

 

 

And to avoid this confusing message
 
you may add this to your css.
And it is not necessary to double the scripts.
Sufficient:
Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Remove the first comment box
    $('#question{QID} ul.ls-answers li:eq(2) .comment-item').remove();
    $('#question{QID} ul.ls-answers li:eq(3) .comment-item').remove();
  });
</script>
<style type="text/css">
  #question{QID} input[type="text"] {
    width: auto;
    display: inline-block;
  }
  div.em_commented_checkbox {
    display:none;
  }
</style>

 

Joffm
  • dangerdangerhighvoltage
  • dangerdangerhighvoltage's Avatar
06 Oct 2023 12:51
Multiple Choice with comments - sum validation problems was created by dangerdangerhighvoltage
Your LimeSurvey version: 6.1.6+230703
Own server or LimeSurvey hosting: own server
Survey theme/template: bootswatch
==================
Hello fellow Limesurvey enjoyers.

I used a "Multiple choice with comments"-question with a javascript to hide the last 2 text fields and if either of the first two options are chosen they need a validation sum of 100, if neither of those options are chosen, the sum validation shouldn't trigger. I tried my hardest, but my lack of knowledge with regex and validation equation in general is showing. I got the sum check to work, but i don't know how to "deactivate" the sumcheck if the last 2 options are chosen.

I attached the lss for you all to check on my mediocre attempt.

The validation attempt:
"if(
    (is_empty(f10b_1comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', f10b_1comment.NAOK))
    and
    (is_empty(f10b_2comment.NAOK) or regexMatch('/^[1-9][0-9]{0,4}$/', f10b_2comment.NAOK))
    , sum(f10b_1comment.NAOK, f10b_2comment.NAOK) == 100 or f10b_3=='Y' or f10b_4=='Y', ''
)


Thanks for the help in advance. :)


 
  • Joffm
  • Joffm's Avatar
02 Oct 2023 20:07
Replied by Joffm on topic Error message when filling out the form
It's obviously an error in the validation equation.

But you didn't show this, 
So at least you should send a lss export of the relevant questions (this one and others which this depends on.

Joffm 
  • Geraldo_Cruz
  • Geraldo_Cruz's Avatar
02 Oct 2023 17:38
Error message when filling out the form was created by Geraldo_Cruz
Please help us help you and fill where relevant:
Your LimeSurvey version: version 3.25.4+201215
Own server or LimeSurvey hosting: Own server (linux)
Survey theme/template:
==================This is the error message “One or more questions were not answered properly. It will not be possible to move forward until the answers are valid.”

All fields have been edited in the "Question validation formula" field how can you check in print

There are fields that depend on others, and when a value is entered incorrectly an error alert appears and the field turns red

However, when the message “One or more questions were not answered correctly. It will not be possible to move forward until the answers are valid.” appears, it takes you directly to the field with error, and this has not happened.

All fields were filled out correctly and the form does not show an inconsistency alertI suspect it is something related to the validation formulas, but I have already changed it and the problem persists.
Has anyone ever had an error like this?
  • Jmantysalo
  • Jmantysalo's Avatar
02 Oct 2023 14:20
Some slow sql queries was created by Jmantysalo
An area for sysadmins does not exists, so I ask here. I put on logging slow sql queries. Here is an example that took 22 seconds:
Code:
SELECT t.uid AS t0_c0, t.users_name AS t0_c1, t.password AS t0_c2, t.full_name AS t0_c3, t.parent_id AS t0_c4, t.lang AS t0_c5, t.email AS t0_c6, t.htmleditormode AS t0_c7, t.templateeditormode AS t0_c8, t.questionselectormode AS t0_c9, t.one_time_pw AS t0_c10, t.dateformat AS t0_c11, t.last_login AS t0_c12, t.created AS t0_c13, t.modified AS t0_c14, t.validation_key AS t0_c15, t.validation_key_expiration AS t0_c16, t.last_forgot_email_password AS t0_c17, t.expires AS t0_c18, permissions.id AS t1_c0, permissions.entity AS t1_c1, permissions.entity_id AS t1_c2, permissions.uid AS t1_c3, permissions.permission AS t1_c4, permissions.create_p AS t1_c5, permissions.read_p AS t1_c6, permissions.update_p AS t1_c7, permissions.delete_p AS t1_c8, permissions.import_p AS t1_c9, permissions.export_p AS t1_c10 FROM lime_users t LEFT OUTER JOIN lime_permissions permissions ON (permissions.uid=t.uid) WHERE (((permissions.permission='superadmin') AND (permissions.read_p='1')) OR (t.uid=1));

And here is EXPLAIN of it+
+
+
+
+
+
+
+
+
+
+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+
+
+
+
+
+
+
+
+
+
+
| 1 | SIMPLE | t | ALL | PRIMARY | NULL | NULL | NULL | 1686 | |
| 1 | SIMPLE | permissions | ALL | NULL | NULL | NULL | NULL | 35429 | Using where; Using join buffer (flat, BNL join) |
+
+
+
+
+
+
+
+
+
+
+No index and 35000 rows sounds bad. But I can't catch when this happens, i.e. sometimes the system is slow and sometimes not. Anything I can do to make this faster?
 
  • Joffm
  • Joffm's Avatar
02 Oct 2023 12:12
Replied by Joffm on topic Exclusive codes when randomizing
Hi,
1.
if(count(that.Q2V1T01.NAOK,that.Q3V1T01.NAOK, that.Q4V1T01.NAOK, that.Q5V1T01.NAOK,that.Q6V1T01.NAOK,that.Q7V1T01.NAOK)>0,Q8V1T01_1.NAOK!="Y",Q8V1T01_1.NAOK=="Y")
This is not a correct validation equation. What do you try to achieve?

2. In the relevance equation of P1301 ff. there is a reference to Q2V3Txx, what is not existing in your lss.

Now to your last idea.
What for do you use the first IF?
Now the string is only created if one of the priority brands is selected. Remove it and
1. the very easy solution
create the string as:
{join(if(tArray_5>0,"E",""),if(tArray_7>0,"G",""),... ( the priority brands)
as you did already.
To get a randomization of the other brands you may use 4 different orders of joining.
Like:
1. Priority brands, other brands in ascending order
2. Priority brands, other brands in descending order
3. Priority brands, other brands in other orders (16,15,14,...,32,31,30,...)
4. Priority brands, other brands in other orders (17,18,19,...,1,2,3,3,...)
Whatever you like.
And with a random number you select the function.
In my opinion this is sufficient to get the other brands randomly.

The way to do it exactly with some equations is described several times here.

Or you use a question of type "multiple short text"
In the first subquestion you enter the joined string of priority brands ("CH")
In the second the string of the other brands.("BLRSUVZ5"
Both you can do by "default answers".
With javascript in this question shuffle the second string and join the first and the second.
So you may getyour 6 final brands as "CHZ5LU"
Later I will create a sample survey; but only a prototype to show the way.

Joffm
 
  • Joffm
  • Joffm's Avatar
01 Oct 2023 20:41
Replied by Joffm on topic Mandatory Input on Demand
"input on demand" is only a visual effect.
If "mandatory" you have to answer all cells.

So the question must not be "mandatory" and you have to use a validation equation to make sure that at least one row is answered.

Joffm 
  • Joffm
  • Joffm's Avatar
30 Sep 2023 18:26
Hi,
I#d recommend to swap the question.
"Sessions" as subquestions, Workshops as answer options
That's the easy way to display or not, or disable (depends on the array filter style) the two sessions if podcast is selected.
Reason: There is no subquestion relevance on answer options.

Now you have to validate that there is only one selection per row and per column.
Here you can use the function "is_unique()", like "is_unique(self)" as validation equation.

And at last the limitation of 25 per Workshop and session.
a. How to remove resp. disable single radio buttons.
Insert a script like this in the source code of the question
Code:
 <script type="text/javascript" charset="utf-8">
$(document).ready(function() {
    // Remove item 1 in in row 1
     $('#question{QID} tr[id^="javatbd"]:eq(0) .radio-item:eq(0) *').remove();
    // Disable item 4 in in row 3
     $('#question{QID} tr[id^="javatbd"]:eq(2) .radio-item:eq(3) *').prop('disabled',true);
});
</script>
With "eq(x) you define the row and the column, always starting with 0.

b. How to count the responses.
Read the manual about the included plugin "statFunctions"
With {statCountIf(Q3_Y001.sgqa,'3')} count the number of selections of code "3" in subquestion "Y001" of question Q3.

Change the script to something like this
Code:
$(document).ready(function() {
   var v11={statCountIf(Q3_Y001.sgqa,'1')};
   var v12={statCountIf(Q3_Y001.sgqa,'2')};
...
   var v21={statCountIf(Q3_Y002.sgqa,'1')};
...
 
  if (v11>25) {
       $('#question{QID} tr[id^="javatbd"]:eq(0) .radio-item:eq(0) *').remove();
  }
if (v12>25) {
       $('#question{QID} tr[id^="javatbd"]:eq(0) .radio-item:eq(1) *').remove();
  }
...
 
});
</script>
 
The first radio button is removed, the second disabled, and the third again removed.
As I wrote before, up to you what you prefer.

Now start to create a sample.
If there are further questions send a lss exort of these relevant questions.

Best regards
Joffm
  • Mon2016
  • Mon2016's Avatar
27 Sep 2023 02:17
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]
Own server or LimeSurvey hosting:
Survey theme/template:
==================
(Write here your question/remark)Hello dear group,

I'm doing a survey of several products and I'm stuck on a validation.

I have a list of 10 Brands that I included in a multiple choice question


Q8. I marked all the brands you have purchased in the last few days.

1.Nike
2.Adidas
3. Cougar
4. Marti
5. Umbro
6. Joga
7. Leslie
8. Dayanne
9. Briceiri
10. Crystal

Now onto my next question.

Q11. You mentioned that you bought Nike, how likely is it that you would buy it again?

In this question I must take 4 random marks from those selected in question Q8.

That is, if they select only 3, I should show three brands, if they select 4 brands I should show those 4 brands, but if they select 5 or more brands I should take 4 random brands to ask my next questions.

I hope someone can help me find the solution.


My version is: Version 3.25.10+210128

I am attaching a test survey.

Thank you all.
  • holch
  • holch's Avatar
05 Sep 2023 19:07
If you go down the text file route, you could think of making a copy of the language file and create your own language, e.g. "English for kids". As this wouldn't be a file that exists in Limesurvey in general, it should not be overwritten during updates. Have a look at manual.limesurvey.org/Translating_LimeSurvey and "create a new translation".
  • AntPIC
  • AntPIC's Avatar
05 Sep 2023 13:41
Replied by AntPIC on topic Question borders and alignment
News
I put 
1. multiple short text (nome e cognome)
1. mutiple short text (one subquestion) with validation (email)
1. mutiple short text (one subquestion) with validation (codice fiscale)

now my problem is to align the two drop-down question

  • AntPIC
  • AntPIC's Avatar
05 Sep 2023 13:02
Question borders and alignment was created by AntPIC
LimeSurvey Cloud
Versione 3.28.66
==================
I have 
1. multi short text (nome e cognome)
1. short text with validation (email)
1. short text with validation (codice fiscale)
1. drop down
How Can I Allign and hide the borders?

I put this code in my custom.css
.no-question { border-top:transparent none; }
.no-question .question-title-container { display:none; }
.no-question .question-valid-container { display:none; }
.no-question .answer-container {
    padding-top: 0em;
    padding-bottom: 0em;

.no-bottom { border-bottom:transparent none;margin-bottom:0; }
.no-bottom .answer-container {
    padding-bottom: 0em;

and another code

@media only screen and (min-width: 768px) {
 
  .inline-answers-question .question-title-container.col-xs-12,
  .inline-answers-question .question-valid-container.col-xs-12,
  .inline-answers-question .answer-container.col-xs-12 {
    width: auto;
  }
 
  .inline-answers-question .question-valid-container,
  .inline-answers-question .answer-container {
    padding-top: 1em;
  }
 
  .inline-answers-question .answer-container > div {
    padding-top: 0;
  }
 
  .inline-answers-question .answer-container .ls-answers {
    padding-top: 0;
  }
 
  .inline-answers-question .answer-container .answer-item {
    display: block;
    float: left;
    clear: none;
    margin-bottom: 0;
  }
}
  • AntPIC
  • AntPIC's Avatar
04 Sep 2023 12:56
could you help me with the css code?
Displaying 91 - 105 out of 182 results.

Lime-years ahead

Online-surveys for every purse and purpose