Welcome, Guest
Username: Password: Remember me

TOPIC: reguar expressions

reguar expressions 4 years 10 months ago #58562

  • eggertli
  • eggertli's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 8
  • Thank you received: 1
  • Karma: 0
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!!!
Last Edit: 4 years 10 months ago by eggertli.
The administrator has disabled public write access.

reguar expressions 4 years 10 months ago #58617

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5421
  • Thank you received: 1156
  • Karma: 480
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?
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.
Moderators: ITEd
Time to create page: 0.214 seconds