Welcome, Guest
Username: Password: Remember me

TOPIC: Conditions based on the word count of a text input field

Conditions based on the word count of a text input field 2 years 10 months ago #65340

  • ollo23
  • ollo23's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 3
  • Karma: 0
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!
The administrator has disabled public write access.

Re: Conditions based on the word count of a text input field 2 years 10 months ago #65344

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4050
  • Thank you received: 740
  • Karma: 341
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Conditions based on the word count of a text input field 2 years 10 months ago #65345

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.127 seconds
Donation Image