Check out the LimeSurvey source code on GitHub!

Conditional after long free text?

3 years 11 months ago #93033 by sD960

I'd like a (non-text) question to appear after a mandatory long free text question, contingent on the survey-taker entering anything at all in the long free text box. (The survey-takers are non-anonymous adults who can be trusted to write something meaningful.) I'm assuming I use regular expressions for this. I've made the second question conditional on /^[-\w]+(?:\W+[-\w]+){0,299}\W*$/ for the first question, but all that happens is Limesurvey thinks the survey ends with the long free text question--that is, the SUBMIT button shows up rather than the NEXT button below the long free text question.

I've no idea what I'm doing wrong. And, for the record, I've never (knowingly) dealt with a regular expression before in my whole life--so please don't be too cryptic in your explanation!

We're using 2.00, Build 121213, and will upgrade in the future but not now. Can't risk changing anything at this point.


Please Log in to join the conversation.

3 years 11 months ago #93070 by sD960
Solved it! There's a "SPECIAL NOTE: Regular Expressions in conditions" in the manual that says "Note that when using regular expressions in the condition editor, do NOT include the beginning and ending slash."

I replaced /^[-\w]+(?:\W+[-\w]+){0,299}\W*$/ with ^[-\w]+(?:\W+[-\w]+){0,299}\W*$ and it works fine. The second question appears as soon as anything is typed into the first long free text question. I assume if I wanted the second question to not appear until after at least several words have been typed into the text box, I'd simply change the 0 in {0,299} to some positive number approximating the number of characters in a short sentence.

So, no response needed unless there's something I missed. Hope this is helpful to someone else!
The following user(s) said Thank You: holch

Please Log in to join the conversation.

3 years 11 months ago #93072 by holch
Thank you for posting your solution. I might help others with a similar problem.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

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