Check out the LimeSurvey source code on GitHub!

Tell somebody that answer entered is not correct

More
4 years 5 months ago #84882 by ricardo01
I want to create a short text question like this:

Please enter the last 4 digits of your phone number:

if the number does not match the number in, say, the token table, I'd like the person gets a warning saying "This number doesn't match the number you entered in the previous survey."

Is this possible to achieve with LS?

This is for a pre-post survey design, which needs to be anonymous, but still we need to compare how a person answered the survey at two different points in time.



ricardo

Please Log in to join the conversation.

More
4 years 5 months ago #84890 by Mazi
This is possible. Using conditions you can show a text display question if the numbers don't match. If your survey is NON anonymous, you can create a condition like
IF question X != token:attribute_y

Note that the user will still be able to click next. You need some custom JavaScript to disable the next button in this case.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
4 years 5 months ago #84891 by TMSWhite
Alternatively, you can use Question Validation Equation

The Question Validation Equation would be:
strlen(trim(X))>=4 && trim(X)!=TOKEN:ATTRIBUTE_1

And the Question Validation Tip would be:
This number doesn't match the number you entered in the previous survey

This approach will show the error message only if the person enters 4 digits and they differ from the stored value. This will also prevent the person from advancing to the next page if they don't enter the correct value.

To ensure that they enter something, you can make the question mandatory.

Please Log in to join the conversation.

More
4 years 5 months ago #84894 by Mazi
Great solution which also makes sure that the user can't proceed to the next question.

I guess we can do something similar when having an email and email confirmation text field?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
4 years 5 months ago #84898 by TMSWhite
Yes, you could do that.

Furthermore, if you are worried about security, you could add a crypt() function to Expression Manager, and change the validation equation to:
strlen(trim(X)>=4 && crypt(trim(X))==TOKEN:ATTRIBUTE_1

Please Log in to join the conversation.

More
4 years 5 months ago #84902 by ricardo01
Thank you guys...Mazi, TMSWhite, you made me curious, so I'd be remiss if I don't ask what would be the equation to use in an email/email confirmation situation

Cheers,

ricardo

Please Log in to join the conversation.

More
4 years 5 months ago #84911 by ricardo01
One more question: How can I make the warning appear in red?

Please Log in to join the conversation.

More
3 years 8 months ago #96444 by dweisser
I know this is an old post, but check this out in relation to your question about matching email fields.
-Nebraska

Please Log in to join the conversation.

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