Welcome to the LimeSurvey Community Forum

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

Array(text) question type, different validation for 1 column of 1 subquestion

  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 1 month ago #180997 by jackrabbithanna
Using Limesurvey Version 2.6.7-lts Build 171212

I want to use the Array (Text) question type, and have several subquestions, and 2 columns...
So let's just say a 4 x 2 array of text fields, the overall question is required.

I've created this, and am able to enforce numeric only answers for the validation rules.

In the question type settings, Mandatory = yes
Validation = /^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$/

I see in the "Advanced Settings" that there can be subquestion logic.

Now I want to have one particular text field have a different validation, that is to be able to be left blank, or maybe have the text "N/A" instead of a number. So 7 of the text fields requires a number, but one is allowed to be left blank.

I am a developer and have javascript I am adding to. The real goal is to actually disable one text field, and have LS let that one particular textfield remain blank without setting a default value.

I was able to add some JS that disables the field and set's a default value for the one field to 0, which then passes validation, and that's great.
I did this with this code:
Code:
$(document).ready(function() {
  $('input[name="342488X1164X2067012a_b"]').val(0);
  $('input[name="342488X1164X2067012a_b"]').attr('readonly', 'readonly');
});

So it seems the disabling is working fine, but on the validation side, I'd prefer not to have to set the value to the form element as 0, and let the question validation pass with this one field being left empty.

What's the best way to get this done? Can there be subquestion logic set in the UI for this case?


Thanks!
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 month ago - 5 years 1 month ago #181001 by DenisChenu
No, best is to use Question validation
manual.limesurvey.org/Question_type_-_Ar...28em_validation_q.29

Something like this : is_numeric(QCODE_SX1_SX2.NAOK)

Edit : more with manual.limesurvey.org/Expression_Manager#Access_to_Functions regexMatch function

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 1 month ago by DenisChenu.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 month ago #181005 by Joffm
Hi,
set the question to "not mandatory".
For the first part I'd enter into the "question validation equation":
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q1_SQ001_X001) and
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q1_SQ001_X002) and
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q1_SQ002_X001) and
...
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q1_SQ004_X002) and

here the "special cell" (here third row, second column)
((regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",QM_SQ003_X002)) or (is_empty(QM_SQ003_X002)) or (QM_SQ003_X002=='N/A'))}

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 1 month ago #181044 by jackrabbithanna
So I wanted the first subquestion, second row to be allowed to be left blank...question id is 12DOT2

So I tried this in the "Validation" field, also set Mandatory = No:
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q12DOT2_SQ001_X001) and
((regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q12DOT2_SQ001_X002)) or (is_empty(Q12DOT2_SQ001_X002)) or (Q12DOT2_SQ001_X002=='N/A'))
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q12DOT2_SQ002_X001) and
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q12DOT2_SQ002_X002) and
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q12DOT2_SQ003_X001) and
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q12DOT2_SQ004_X002) and
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q12DOT2_SQ004_X001) and
regexMatch("^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$",Q12DOT2_SQ004_X002)

When I look at the "Check Survey Logic" it blows up with red...
Should I be replacing Q1 in your example, with Q12DOT2 ?

On the check survey logic page for the question
In the "Relevance [Validation] (Default value)"
Code:
((sum((if(is_empty(asG3S1Q12DOT2_12a_a.NAOK), 0, ! regexMatch("regexMatch(" ^ ( [ 0 - 9 ] | [ 1 - 8 ] [ 0 - 9 ] | 9 [ 0 - 9 ] | [ 1 - 8 ] [ 0 - 9 ] { 2 } | 9 [ 0 - 8 ] [ 0 - 9 ] | 99 [ 0 - 9 ] | 1000) $ ",Q12DOT2_SQ001_X001) and ((regexMatch(" ^ ( [ 0 - 9 ] | [ 1 - 8 ] [ 0 - 9 ] | 9 [ 0 - 9 ] | [ 1 - 8 ] [ 0 - 9 ] { 2 } | 9 [ 0 - 8 ] [ 0 - 9 ] | 99 [ 0 - 9 ] | 1000) $ ",Q12DOT2_SQ001_X002)) or (is_empty(Q12DOT2_SQ001_X002)) or (Q12DOT2_SQ001_X002=='N/A')) regexMatch(" ^ ( [ 0 - 9 ] | [ 1 - 8 ] [ 0 - 9 ] | 9 [ 0 - 9 ]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] | 1000) $ ",Q12DOT2_SQ004_X001) and regexMatch(" ^ ( [ 0 - 9 ] | [ 1 - 8 ] [ 0 - 9 ] | 9 [ 0 - 9 ] | [ 1 - 8 ] [ 0 - 9 ] { 2 } | 9 [ 0 - 8 ] [ 0 - 9 ] | 99 [ 0 - 9 ] | 1000) $ ",Q12DOT2_SQ004_X002)", asG3S1Q12DOT2_12d_b.NAOK)))) == 0))

something not quite right here, it's like it's trying to put my conditionals inside a sum function which has another regexMatch function.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 month ago - 5 years 1 month ago #181046 by DenisChenu
For complex equation : i use tab and newline on a good text editor (to check parenthesis).

And here : where is the red part, you have a help when you move your mouse on.

Another thing : do your equation line by line (testing each line)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 1 month ago by DenisChenu.
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 1 month ago - 5 years 1 month ago #181047 by jackrabbithanna
Ok, changed the double quotes to single quotes, and that fixed alot of the red...

Now I got:
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ001_X001) and
((regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ001_X002)) or (is_empty(Q12DOT2_SQ001_X002)) or (Q12DOT2_SQ001_X002=='NA')) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ002_X001) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ002_X002) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ003_X001) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X002) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X001) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X002)

and on the Check Survey Logic File for question, lots of red disappeared in the Relevance [Validation] (Default value)

Now it shows me an error, below the first comma and the first regexMatch are highlighted in red..
Hold mouse over the comma it says, "Extra comma found in function" and hold mouse over first regex, it says "Invalid PERL Regular Expression regexMatch("

Only putting first bit of the "Relevance [Validation] (Default value)" column output:

((sum((if(is_empty(asG3S1Q12DOT2_12a_a.NAOK), 0, ! regexMatch("regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ001_X001) and ((regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ001_X002)) or (is_empty(Q12DOT2_SQ001_X002)) or (Q12DOT2_SQ001_X002=='NA')) regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ002_X001) and regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ002_X002) and regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ003_X001) and regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X002) and regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X001) and regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X002)", asG3S1Q12DOT2_12a_a.NAOK))),
Last edit: 5 years 1 month ago by jackrabbithanna.
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 1 month ago #181050 by jackrabbithanna
Ok, so wrapping the whole bit in curly bracket's got rid of the relevance validation errors, so:
{regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ001_X001) and
((regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ001_X002)) or (is_empty(Q12DOT2_SQ001_X002)) or (Q12DOT2_SQ001_X002=='NA')) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ002_X001) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ002_X002) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ003_X001) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X002) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X001) and
regexMatch('^([0-9]|[1-8][0-9]|9[0-9]|[1-8][0-9]{2}|9[0-8][0-9]|99[0-9]|1000)$',Q12DOT2_SQ004_X002)}

Feeling like I'm getting close now!

Probably just need to get the question id right...

Sensing great power is available here in Limesurvey....
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 1 month ago #181055 by DenisChenu
Screenshot (or sample lss with only this question) are better to get answers.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 1 month ago #181060 by jackrabbithanna
It's definitely a problem with getting what the question code should be...

I'm backing off and just trying some simple stuff.

So let's say I just want to see if the first subquestion, second column textfield is NOT empty

The "Code" field at the top of the question is set to:
asG3S1Q12DOT2

I try something like:
{!is_empty(asG3S1Q12DOT2_SQ001_X002)}
or
{!is_empty(Q12DOT2_SQ001_X002) == FALSE}

neither of which works...

I know that evaluation is working, in a since that if I put
{is_empty(asG3S1Q12DOT2_SQ001_X002)}
the validation returns true ...

So I guess I don't understand what the question codes should be for this interpreter.
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 1 month ago #181062 by jackrabbithanna
I've uploaded the export file for this one question. I can't give you'll the entire survey. I had to rename it from a .lsq to a .lss so that your file upload validation would allow it.
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 1 month ago #181063 by jackrabbithanna
Seems like this is a clue
So question code = 'asG3S1Q12DOT2'
First subquestion is '12a'
second answer is, 'b'


{is_empty(asG3S1Q12DOT2_12a_b)}

Now if I put the above in, ALL of the textfields of the Array (Text) here must be empty, and the validation passses ...
I would expect that only the second answer of the first subquestion would need be empty for it to pass...

Maybe if I can understand how to do this one bit, the rest will follow
The topic has been locked.
  • jackrabbithanna
  • jackrabbithanna's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
5 years 1 month ago #181075 by jackrabbithanna
Don't mind me, I was just being dumb. Note to self, put the equation in the "Question validation" textbox in the "Logic" fieldset, not into the "Validation" field in the main question settings...

I guess that "Validation" field is always expecting a regex pattern?

Anyway, this takes me half way to my goal, thanks for the support, surprised I even got any response.

Now to wade through the 5K lines of custom javascript that make up this crazy survey system they got here.

Thank You!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose