- Posts: 34
- Thank you received: 3
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Validating just a subquestion in an array text question
- mfiora
- Topic Author
- Offline
- Official LimeSurvey Partner
Less
More
6 years 6 days ago #167469
by mfiora
Validating just a subquestion in an array text question was created by mfiora
Hello,
i'd need an answer to a subquestion in an array text question to match a regular expression.
I looked around finding a way but simply could not.
First of all, where should i set it? In the question validation or in the sub-question validation?
I found out the SGQ(row and column) identifier but any test could not help.
Could you please provide me with an example?
Thank you very much.
i'd need an answer to a subquestion in an array text question to match a regular expression.
I looked around finding a way but simply could not.
First of all, where should i set it? In the question validation or in the sub-question validation?
I found out the SGQ(row and column) identifier but any test could not help.
Could you please provide me with an example?
Thank you very much.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12908
- Thank you received: 3970
6 years 5 days ago - 6 years 5 days ago #167473
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Validating just a subquestion in an array text question
Hello, mfiora,
The other way: You should provide us with an example (*.lss).
That we exactly know what you are trying to achieve.
Best regards
Joffm
P.S. Without knowing more I can say:
in the question validation you can to access this special field by something like
Q1_SQ001_A3
Q1= Question code
SQ001 = Subquestion code (y-axis)
A3 = code of x-axis
Q1_SQ001_A3=="lorem ipsum" validates this field to this special text.
In your case it will be something like this in "question validation":
is_empty(self.sq_SQ001_A3) or regexMatch('/^[1-9]{1,3}$/',self.sq_SQ001_A3)
More explanation about this:
manual.limesurvey.org/Expression_Manager....27that.27_variables
and:
manual.limesurvey.org/Expression_Manager..._with_X_and_Y_scales
Could you please provide me with an example?
The other way: You should provide us with an example (*.lss).
That we exactly know what you are trying to achieve.
Best regards
Joffm
P.S. Without knowing more I can say:
in the question validation you can to access this special field by something like
Q1_SQ001_A3
Q1= Question code
SQ001 = Subquestion code (y-axis)
A3 = code of x-axis
Q1_SQ001_A3=="lorem ipsum" validates this field to this special text.
In your case it will be something like this in "question validation":
is_empty(self.sq_SQ001_A3) or regexMatch('/^[1-9]{1,3}$/',self.sq_SQ001_A3)
More explanation about this:
manual.limesurvey.org/Expression_Manager....27that.27_variables
and:
manual.limesurvey.org/Expression_Manager..._with_X_and_Y_scales
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 5 days ago by Joffm.
The topic has been locked.
- mfiora
- Topic Author
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 34
- Thank you received: 3
6 years 5 days ago #167477
by mfiora
Replied by mfiora on topic Validating just a subquestion in an array text question
Hello Joffm and thanks for your reply,
You can see attached the test survey. I would like the fiscal code to match the regular expression
and highlight the field if it doesn't match.
I still am confused on where should i put the code you provided me with, sorry.
Thanks
You can see attached the test survey. I would like the fiscal code to match the regular expression
Code:
/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/
and highlight the field if it doesn't match.
I still am confused on where should i put the code you provided me with, sorry.
Thanks
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12908
- Thank you received: 3970
6 years 5 days ago #167479
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Validating just a subquestion in an array text question
Hi, mfiora,
1. you were confused about the syntax "self.sq_Y-X"
The first is the code of the y-axis, the second of the x-axis.
Because you named the y-axis "1", "2", "3", and the x-ais "SQ001" you entered a wrong statement.
And you enter it in
I assume there will be more columns - otherwise you should have used a "multiple short text" question.
So you have to o this for all columns:
(is_empty(self.sq_3_SQ001) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ001)) AND
(is_empty(self.sq_3_SQ002) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ002)) AND
(is_empty(self.sq_3_SQ003) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ003))
2. Example (a correct code)
something else
Best regards
Joffm
1. you were confused about the syntax "self.sq_Y-X"
The first is the code of the y-axis, the second of the x-axis.
Because you named the y-axis "1", "2", "3", and the x-ais "SQ001" you entered a wrong statement.
And you enter it in
I assume there will be more columns - otherwise you should have used a "multiple short text" question.
So you have to o this for all columns:
(is_empty(self.sq_3_SQ001) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ001)) AND
(is_empty(self.sq_3_SQ002) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ002)) AND
(is_empty(self.sq_3_SQ003) or regexMatch('/^(\w{6}\d{2}\w\d{2}\w\d{3}\w)|(\d{11})$/',self.sq_3_SQ003))
2. Example (a correct code)
something else
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- mfiora
- Topic Author
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 34
- Thank you received: 3
6 years 5 days ago #167480
by mfiora
Replied by mfiora on topic Validating just a subquestion in an array text question
Hello Joffm,
i found out. First there was some confusion between X and Y axis. Then i probably got lost in translation because you typed "Question validation" and i thought about "validation" field, but it was "Question validation equation".
And i also found a problem in Regexp.
Now it works.
Thanks for your support and patience.
i found out. First there was some confusion between X and Y axis. Then i probably got lost in translation because you typed "Question validation" and i thought about "validation" field, but it was "Question validation equation".
And i also found a problem in Regexp.
Now it works.
Thanks for your support and patience.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12908
- Thank you received: 3970
6 years 5 days ago - 6 years 5 days ago #167481
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Validating just a subquestion in an array text question
Hi, mfiora,
sorry,
yes, I know: I always wite "question validation" and "subquestion validation" instead of "... equation"
But nevertheless, I learned about Italian fiscal codes.
Nobody knows when I will need this knowledge.
Best regards
Joffm
sorry,
yes, I know: I always wite "question validation" and "subquestion validation" instead of "... equation"
But nevertheless, I learned about Italian fiscal codes.
Nobody knows when I will need this knowledge.
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 years 5 days ago by Joffm.
The topic has been locked.