Welcome to the LimeSurvey Community Forum

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

multiple sub-question validation in text array

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 months 4 weeks ago #246315 by AntPIC
LimeSurvey Cloud
Versione 3.28.66

==================I have a text array with 6 columns and 10 rows. The rows open according to the number of operators indicated in the previous question. I tried to insert the validation of the sub-questions by email tax code and last column field max 2 characters. the controls work but it tells me that I must always fill in all ten operators. For example, if in the previous question I indicate 4 operators and correctly fill in the relative fields in the array, however, it returns an error and lets me continue only if I fill in all 10 operators. I insert the formula and the screenshot below

regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ001_SQ003.NAOK)) AND ('/^.+?@.+?\..+$/', F1a_SQ001_SQ004.NAOK) AND strlen(F1a_SQ001_SQ006)==2 AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ002_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ002_SQ004.NAOK) AND strlen(F1a_SQ002_SQ006)==2  AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ003_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ003_SQ004.NAOK) AND strlen(F1a_SQ003_SQ006) ==2 AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ004_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ004_SQ004.NAOK) AND strlen(F1a_SQ004_SQ006)==2 AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ005_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ005_SQ004.NAOK) AND strlen(F1a_SQ005_SQ006)==2 AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ006_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ006_SQ004.NAOK) AND strlen(F1a_SQ006_SQ006)==2 AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ007_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ007_SQ004.NAOK) AND strlen(F1a_SQ007_SQ006)==2 AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ008_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ008_SQ004.NAOK) AND strlen(F1a_SQ008_SQ006)==2 AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ009_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ009_SQ004.NAOK) AND strlen(F1a_SQ009_SQ006)==2 AND
regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ010_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ010_SQ004.NAOK) AND strlen(F1a_SQ010_SQ006)==2

 

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 4 weeks ago #246316 by tpartner
Replied by tpartner on topic multiple sub-question validation in text array
Put in new conditions to bypass yours depending on the value of the "operators" question.
Code:
    operators < 1
    OR
    (
        regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ001_SQ003.NAOK)) 
        AND 
        regexMatch('/^.+?@.+?\..+$/', F1a_SQ001_SQ004.NAOK) 
        AND 
        strlen(F1a_SQ001_SQ006)==2
    )
AND
    operators < 2
    OR
    (
        regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ002_SQ003.NAOK)) 
        AND 
        regexMatch('/^.+?@.+?\..+$/', F1a_SQ002_SQ004.NAOK) 
        AND 
        strlen(F1a_SQ002_SQ006)==2
    )
AND
...

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 months 4 weeks ago #246318 by AntPIC
Thanks! But it does not work..
i put this code

F1.Naok<1
OR
(regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ001_SQ003.NAOK)) AND ('/^.+?@.+?\..+$/', F1a_SQ001_SQ004.NAOK) AND strlen(F1a_SQ001_SQ006)==2) AND
F1.Naok<2 OR
(regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ002_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ002_SQ004.NAOK) AND strlen(F1a_SQ002_SQ006)==2) AND
F1.Naok<3 OR
(regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ003_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ003_SQ004.NAOK) AND strlen(F1a_SQ003_SQ006) ==2) AND
...

I don't know what is the problem

Please Log in to join the conversation.

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 months 4 weeks ago #246330 by AntPIC
whatever I enter it asks me to always validate all 10 operators, even if 4 appear on the basis of the previous question. How can I fix?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 4 weeks ago - 7 months 4 weeks ago #246342 by Joffm
Hi,
is this exactly the code you entered?

1. It is NAOK, not Naok. These things are case sensitive.
2. AND ('/^.+?@.+?\..+$/', F1a_SQ001_SQ004.NAOK)   regexMatch is missing
3. Check for hidden HTML, like <br>. Insert it into the question text with surrounding curly brackets and you will see.
With this changed the syntax is correct.

And add ".NAOK" to the "strlen " term.

Now I do not see an issue with this (I shortened the fiscal regex for testing)
(F1.NAOK<1 OR (regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}$/", strtoupper(F1a_Y001_X003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_Y001_X004.NAOK) AND strlen(F1a_Y001_X006.NAOK)==2)) AND
(F1.NAOK<2 OR (regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}$/", strtoupper(F1a_Y002_X003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_Y002_X004.NAOK) AND strlen(F1a_Y002_X006.NAOK)==2)) AND
(F1.NAOK<3 OR (regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}$/", strtoupper(F1a_Y003_X003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_Y003_X004.NAOK) AND strlen(F1a_Y003_X006.NAOK)==2)) AND (F1.NAOK<4 OR (regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}$/", strtoupper(F1a_Y004_X003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_Y004_X004.NAOK) AND strlen(F1a_Y004_X006.NAOK)==2))

...





Very probably "role" has a limited number of possible answer options.
So I advice to use drop-downs here and also for the last "Si/No" question.
Though you check for "strlen==2" you still can enter "xx", "1a", or whatever.
If you keep the role as a free text question, you will have a lot to recode in your analysis.

Could be like this
 
 
You only have to check for "not empty".

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 7 months 4 weeks ago by Joffm.

Please Log in to join the conversation.

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 months 4 weeks ago #246350 by AntPIC
Thank you very much Joffm.
with this code now work

(F1.NAOK<1 OR (regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ001_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ001_SQ004.NAOK) AND strlen(F1a_SQ001_SQ006.NAOK)==2)) AND
(F1.NAOK<2 OR (regexMatch("/^[A-DF-HJ-NP-TV-Z]{6}[0-9]{2}[A-EHLMPRST]([04][1-9])|([1-25-6][0-9])|([37][01])[A-Z][0-9]{3}[A-Z]$/", strtoupper(F1a_SQ002_SQ003.NAOK)) AND regexMatch('/^.+?@.+?\..+$/', F1a_SQ002_SQ004.NAOK) AND strlen(F1a_SQ002_SQ006.NAOK)==2)) AND
...

but i didn't understand how to do this?
3. Check for hidden HTML, like <br>. Insert it into the question text with surrounding curly brackets and you will see.
With this changed the syntax is correct.

I know I have to put drop-down. I asked before, but as I told you i don't know how programming language. Is there a simple way to do drop-down in the array text? Or for check the insert answer?

Thanks a lot indeed

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 4 weeks ago #246360 by Joffm

Insert it into the question text with surrounding curly brackets and you will see.

As I wrote:
You have your validation equation
 
copy it to the question text (with curly brackets)
 
You see that there is some HTML garbage, that might cause problems.
 

Here you only see THAT something is wrong, but not the reason.
 

Is there a simple way to do drop-down in the array text?

Rather simple.
There are dozens of examples in the forum. Just search for it.
But here one of the threads
[url] forums.limesurvey.org/index.php/forum/in...rray-question#244681 [/url]
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 4 weeks ago #246376 by Joffm
What @lfanfoni in the Italian forum explained may be this
 
 

Easy to implement, easy to validate

As you see it is one group with 4 questions
a. nome & cognome
b. codice
c. E-mail
d. the dropdowns

All merged with css classes "no-question" and "no-bottom"
Advantage
You validate each question separately.
All questions are mandatory.

And you show the groups accprding to the number of operators.

As @lfanfoni already mentioned your actual approach is not really usable in an online survey, it seems to be an adaptation of a paper-pencil questionnaire.
For online surveys you may read this
 

File Attachment:

File Name: surveyfrie...8-31.zip
File Size:977 KB


Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 months 4 weeks ago - 7 months 4 weeks ago #246391 by AntPIC
A thousand thanks!
I tried inserting in
multiple short text
First name
Surname
Tax ID code
E-mail
with validation equations e
two single choice (drop-down) for
Role
Credentials
It is certainly the methodologically correct way.
The problem now is what to insert in the individual CSS Class/s to have a clean screen like Joffman's
Last edit: 7 months 4 weeks ago by AntPIC. Reason: translate

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 4 weeks ago #246518 by tpartner
Replied by tpartner on topic multiple sub-question validation in text array
Please use English in this section of the forums.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 months 4 weeks ago #246522 by AntPIC
A thousand thanks!
I tried inserting in
multiple short text
First name
Surname
Tax ID code
E-mail
with validation equations e
two single choice (drop-down) for
Role
Credentials
It is certainly the methodologically correct way.
The problem now is what to insert in the individual CSS Class/s to have a clean screen like Joffman's

Please Log in to join the conversation.

  • AntPIC
  • AntPIC's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 months 3 weeks ago #249867 by AntPIC
could you help me with the css code?

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose