Welcome, Guest
Username: Password: Remember me

TOPIC: Validate text input from database

Validate text input from database 11 months 3 weeks ago #100551

  • wilfredor
  • wilfredor's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
Greetings to all members of this forum.

This is my first post in this forum, I'm new in LimeSurvey development area, however, I possess knowledge of Jquery,JavaScript and php.

My question is focused on the validation of a simple text field. Validation would be as follows:

1. The user enters an ID in a question of simple text field.
2. The ID entered by the user is looked up in a table in a database-not limesurvey
3. In case the ID is found in the table database, the field is successfully validated
The administrator has disabled public write access.

Validate text input from database 11 months 3 weeks ago #100553

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4205
  • Thank you received: 790
  • Karma: 360
I think you'll need to fire an AJAX call to a remote script that accesses your ID. database and returns true/false. (probably on keyup or change of the text input)

Depending on the returned result, you could toggle a hidden question and then use conditions, relevance or quotas to control further access to the survey.
Cheers,
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.

Validate text input from database 11 months 3 weeks ago #100555

  • wilfredor
  • wilfredor's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 2
  • Karma: 0
I fully understand what needs to be done, however. My specific question is the way to do this is good practice. I mean, what files to edit.

Thank you very much.
The administrator has disabled public write access.

Validate text input from database 11 months 3 weeks ago #100557

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4205
  • Thank you received: 790
  • Karma: 360
You can place the code for the AJAX call in the question source or in template.js.

manual.limesurvey.org/Workarounds:_Manip....29_in_LimeSurvey.3F
Cheers,
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.
The following user(s) said Thank You: wilfredor
Moderators: ITEd
Time to create page: 0.113 seconds
Donation Image