If you just want to check the number of words, you may create a customized response check. To count the number of words, you may use substr_count()
and count blanks, or (more accurately) use aregular expression and preg_match_all()
to count, e.g., words with at least two characters:
preg_match_all('/\\w{2,}/iu', value('AB01_01'), $matches);
if (count($matches[0]) < 50) {
repeatPage('message50');
}
If you would like to count via JavaScript, you can use the same regular expression, and either update the count on every keystroke in the text area (e.g., to display the words) and/or use SoSciTools.attachCheck() to register a function that is called before the form is submitted. Note, that this check can be circumvented by disabling JavaScript, while the PHP-based check cannot.