I need to set a minimum number of characters or words in my questionnaire. I have chosen a long text box, and I have set the maximum number of characters to 1800, and I would like to set the minimum to 1000 characters (or the minimum to 200 words and the maximum to 300 words).
I used several regular expressions, but I don't know where to type them (conditional filter equation, or question validation equation). I tried :
{ ^[-\w]+(?:\W+[-\w]+){199,200}\W*$} --> syntax not recognized by LimeSurvey
{strlen(this) > 1000} --> seems not to work even if syntax is recognized
{^.{200,}$} --> syntax not recognized
I'm stuck at this point. Could someone explain to me where exactly I should enter the regular expression, and which one is the right one to limit the number of characters or words?
You have two conditions
1. length of string ge 1000 characters
2. length of string le 2000 characters
So you have a validation equation of strlen(Q1.NAOK) ge 1000 AND strlen(Q1.NAOK) le 2000
And in the validation tip you may create something like
{if(strlen(Q1.NAOK) lt 1000,"Please enter at least than 1000 characters",if(strlen(Q1.NAOK) gt 2000,"Please enter less than 2000 characters","That's fine"))}
Or whatever you like.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, fmerken
Thanks a lot, it's been very helpful. Everything works now, except the fact that I still can't display the number of characters the participant is at. On the pictures that you posted, there's a text at the bottom of the box saying "Your text contains ... characters". How can add this?
Sorry about the double post, I'm new here and didn't know best.
You have entered {strlen(self.NAOK)} characters of {if(strlen(self.NAOK) lt 1000,"a minimum of 1000",if(strlen(self.NAOK) gt 2000,"a maximum of 1800","in between 1000 and 1800 characters"))}