Welcome, Guest
Username: Password: Remember me

TOPIC: Tell somebody that answer entered is not correct

Tell somebody that answer entered is not correct 2 years 1 month ago #84882

  • ricardo
  • ricardo's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 116
  • Thank you received: 1
  • Karma: 0
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
The administrator has disabled public write access.

Re: Tell somebody that answer entered is not correct 2 years 1 month ago #84890

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
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)limesurvey.org'"
The administrator has disabled public write access.

Re: Tell somebody that answer entered is not correct 2 years 1 month ago #84891

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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.
The administrator has disabled public write access.

Re: Tell somebody that answer entered is not correct 2 years 1 month ago #84894

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5331
  • Thank you received: 296
  • Karma: 249
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)limesurvey.org'"
The administrator has disabled public write access.

Re: Tell somebody that answer entered is not correct 2 years 1 month ago #84898

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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
The administrator has disabled public write access.

Re: Tell somebody that answer entered is not correct 2 years 1 month ago #84902

  • ricardo
  • ricardo's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 116
  • Thank you received: 1
  • Karma: 0
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
The administrator has disabled public write access.

Re: Tell somebody that answer entered is not correct 2 years 1 month ago #84911

  • ricardo
  • ricardo's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 116
  • Thank you received: 1
  • Karma: 0
One more question: How can I make the warning appear in red?
The administrator has disabled public write access.

Re: Tell somebody that answer entered is not correct 1 year 4 months ago #96444

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 205
  • Thank you received: 5
  • Karma: 5
I know this is an old post, but check this out in relation to your question about matching email fields.
-Nebraska
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.265 seconds
Donation Image