Check out the LimeSurvey source code on GitHub!

Conditions based on the word count of a text input field

More
5 years 5 months ago #65340 by ollo23
Hi,
I need to use the count of words putted into an text input as a condition of another question (i. e. Show Q2 if Q1(text input) has less than 5 words given). Does anyone know if (and how) that's possible?

Many thanks!

Please Log in to join the conversation.

More
5 years 5 months ago #65344 by tpartner
I think you'll need to use JavaScript.

If the questions are on the same page you can simply have a script show or hide Q2 based on the number of words entered in Q1 (probably with an onkeyup listener).

If the questions are on separate pages you will need to populate a hidden question that can be used for the condition.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 5 months ago #65345 by TMSWhite
And in LimeSurvey 1.92, it would be trivial to add the str_word_count function ( php and javascript versions exist), so you could count words that way and have the word count be the relevance criteria for whether or not to display Q2. See info about relevance here .

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form