Welcome to the LimeSurvey Community Forum

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

Word count error in long free text

  • FZ_Augsburg
  • FZ_Augsburg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 11 months ago #119703 by FZ_Augsburg
Word count error in long free text was created by FZ_Augsburg
Dear all,

I found this site with information on regular expression to count words in a long free text ( manual.limesurvey.org/Using_regular_expressions#Word_count ). I've used /^[-\w]+(?:\W+[-\w]+){149,1500}\W*$/ and entered it into the validation field (below relevance equation). However, when doing the survey, I get an error, as if the question has not been answered correctly (although there are more than 150 words in the field). A logic test does not yield any insights. Can you please help me out here?


My version is Version 2.05+ Build 150310.
Best,
Andreas
The topic has been locked.
  • FZ_Augsburg
  • FZ_Augsburg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 11 months ago #119721 by FZ_Augsburg
Replied by FZ_Augsburg on topic Word count error in long free text
BTW: the question is a obligatory question.
I've also tried without the forward slash at the beginning and end and used different numbers. It still does not work.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago - 8 years 11 months ago #119726 by tpartner
Replied by tpartner on topic Word count error in long free text
Given a question code of "q1", try using this in the "Question validation equation" setting:
Code:
regexMatch('/^[-\w]+(?:\W+[-\w]+){149,1500}\W*$/', q1)

And, you could use something like this in the "Question validation tip" setting:
Code:
{if(q1 != '' && !regexMatch('/^[-\w]+(?:\W+[-\w]+){149,1500}\W*$/', q1), 'Please enter between 150 and 1500 words.', '')}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 11 months ago by tpartner.
The topic has been locked.
  • FZ_Augsburg
  • FZ_Augsburg's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 11 months ago #119754 by FZ_Augsburg
Replied by FZ_Augsburg on topic Word count error in long free text
Hi Toni,

thank you for your help. It still does not work. Once I enter more than 150 words, the text field changes from red to white, but if I click on continue I get the error message that the question has not been answered correctly like it would be if I did not fill in the question (in German it reads:Eine oder mehrere Fragen sind nicht korrekt beantwortet worden. Sie können nicht fortfahren, bevor die Antworten nicht korrekt beantwortet sind.). Do you know why limesurvey does not accept the text?

Best,
Andreas
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago #119756 by DenisChenu
Replied by DenisChenu on topic Word count error in long free text
Hi,

Can you upload a little lss file with just this question (and less than 150 word needed ;) ).
What is you LS version and build number ?

Denis

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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago #119769 by tpartner
Replied by tpartner on topic Word count error in long free text
FZ_Augsburg, here is a working survey for LS 2.05. The long-text question is restricted to 5-10 words.

File Attachment:

File Name: limesurvey...8181.lss
File Size:13 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu, SashaNS
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose