Welcome to the LimeSurvey Community Forum

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

Text Array Question subquestion input limiter

  • giorgi
  • giorgi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 1 month ago #227740 by giorgi
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 5.3.11+220425
Own server or LimeSurvey hosting: hostinger.com
Survey theme/template: fruity
==================
Hello,

i'm having the trouble to limit the inputs for each field for text array question. i have 4 Y-scale items and 3 for X-scale. i want users to be limited only to enter numbers from 0 to 3 in each field. 
I tried subquestion validation /^[0-3]{1}$/ but i guess i have to point to each subquestion code, can't figure it out 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 1 month ago - 3 years 1 month ago #227745 by Joffm
Hi,

If I understood correctly you tried to use this /^[0-3]{1}$/ in "Logic / validation equation".
Here you have to use the function "regexMatch(pattern,QCode)" 
To use your regex you enter it in "Gerneral settings / validation"

In my opinin you'd use an array(numbers) wth
text input
min value: 1
max value: 3

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 1 month ago by Joffm.

Please Log in to join the conversation.

  • giorgi
  • giorgi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 1 month ago - 3 years 1 month ago #227762 by giorgi

Hi,

If I understood correctly you tried to use this /^[0-3]{1}$/ in "Logic / validation equation".
Here you have to use the function "regexMatch(pattern,QCode)" 
To use your regex you enter it in "Gerneral settings / validation"

In my opinin you'd use an array(numbers) wth
text input
min value: 1
max value: 3

Joffm
General settings / validation worked like a charm, thank you.
Just a quick follow-up, is there a way to reference in text array subquestion validation second column (case is that, user enters values for 8 items, 1st column is the number of times item used and 2nd column is rank). The aim is to only force user to enter values from 0 to 3 in 2nd column. the patterns of the question is the database is G02Q16_1_1 to G02Q16_8_1 for first column and G02Q16_1_2 to G02Q16_8_2. So how can i put reference to subquestion validation for G02Q16_1_2 to G02Q16_8_2
Last edit: 3 years 1 month ago by giorgi.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 1 month ago #227770 by Joffm
In question validation equation:

regexMatch("/^[0-3]{1}$/",G02Q16_1_2) AND regexMatch("/^[0-3]{1}$/",G02Q16_2_2) and ...
But your expression has to cover that the field is empty.
Or you add this condition to each row like
is_empty(QCode) or regexMatch(pattern,QCode)

 

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

Please Log in to join the conversation.

  • giorgi
  • giorgi's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 1 month ago #227772 by giorgi
Thanks a lot, it worked ^_^ i didn't include for empty, as question is still mandatory and all items needs to be filled. Before even i tried same syntax but with regexMatch("/^[0-3]{1}$/",self.sq_1_2) it didn't work, only regexMatch("/^[0-3]{1}$/",G02Q16_n_2) pattern.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 1 month ago #227774 by Joffm
You should allow empty entries in the regex
Otherwise you have an initial error message, as all fields are empty, what is not allowed by you regex.
This doesn't look very professional.

And you afford to  allow "empty" by regex because the question is mandatory.
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: giorgi

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose