Check out the LimeSurvey source code on GitHub!

reguar expressions

More
5 years 11 months ago - 5 years 11 months ago #58562 by eggertli
Hello,
I use version 1.90. I got a question (let's call it "Code") which has to fit a regular expression. If it fits the participant is forwarded to next questions.
Now I want to resolve the following problem: If the term "Code" does not fit the regular expression I want to show a question like "false Code, please try again" or something like this. I only want this message to be shown if the answer to "Code" was invalid... But I am not able no negate a regular expression (It seems to be impossible as I learned during my search, you cannot negate a regular expression at all). So what could I do? I need an if condition which refers to "Code", because else the message appears for valid answers to "Code" too... What to do if jump branching is not possible? How cpuld I express: if not "Code"=regular expression, then show message?
Thanks a lot for every help!!!
Greeting,
Lisa
Last Edit: 5 years 11 months ago by eggertli.

Please Log in to join the conversation.

More
5 years 10 months ago #58617 by tpartner
You could use JavaScript to validate the input against the regex and then populate a hidden question accordingly (pass or fail). Subsequent questions could be shown with conditions with conditions based on the hidden question.

Are all questions on the same page or separate pages?

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.

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