How to create a custom PIN number on End Message/question

More
2 months 5 days ago - 2 months 5 days ago #173686 by RitaShen
RitaShen created the topic: How to create a custom PIN number on End Message/question
Hi there,

I have a question type, but I have no idea does it can work on LimeSurvey.

How to create a custom PIN number on End Message or in the question, each respondents will see their own unique PIN number. 100 respondents will have 100 unique PIN number.

how could I do this on the limesurvey?

Many thanks
Rita
Last Edit: 2 months 5 days ago by RitaShen.

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago #173688 by jelo
jelo replied the topic: How to create a custom PIN number on End Message/question
What purpose has the PIN?
What format is needed?

You could use the respondent ID {SAVEID} and combine that ID (which is too easy to guess when used as PIN) with randomnumbers.

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago #173690 by RitaShen
RitaShen replied the topic: How to create a custom PIN number on End Message/question
it's the coupon PIN
every one will have specify PIN number
they can use this PIN number to buy something.
as the Respondents finish the survey, they can will see their own PIN number on the END PAGE or in next page.

e.g.
Respondent A will see this PIN number : G12A35
Respondent B will see this PIN number : Z1553w
Respondent C will see this PIN number : O82aw7

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago #173715 by DB1324
DB1324 replied the topic: How to create a custom PIN number on End Message/question
I'm looking to do the exact same thing - we use multiple systems, and want to generate a not-immediately-predictable PIN to be entered into our other programmes to ensure participant records aren't mixed up.

RitaShen - I would be interested to hear if you are successful with this.

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago #173716 by jelo
jelo replied the topic: How to create a custom PIN number on End Message/question
If respondent get the URL with a token, you can create the PIN as an additional attribute and assign a unpredictable PIN to every token.
Since the PIN should be check in other systems, when respondents enter them, you can work with precreated PINs.

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago #173717 by holch
holch replied the topic: How to create a custom PIN number on End Message/question
I think the most important question is:

Can the PIN be created any way you want or do you need to use predefined PINs. Approaches need to be different for both options, I guess.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
2 months 5 days ago #173730 by Joffm
Joffm replied the topic: How to create a custom PIN number on End Message/question
Hi,.
If there is a predefined list of numbers, you may use an ajax call to select one.
I am not sure if I provided an example a few weeks ago.
Anyway, I will do it on Thursday when I am back home.
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in or Create an account to join the conversation.

More
2 months 3 days ago #173813 by Joffm
Joffm replied the topic: How to create a custom PIN number on End Message/question
Hi,
here the promised example:
In my survey I have a hidden question of type "short text" with this javascript to do the ajax call:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
       $.post('https://www.myServerr.com/myFolder/getCode.php',function(data) {
 
                   $('#question{QID} input[type="text"]').val(data)
 
	});
        $('#question{QID}').hide();
);
</script>

In my database I created a table "voucher" with three fields:
1. id (autoincrement)
2. vouchercode (varchar(20))
3. status (Tinyint) This as flag, if the code was already used


And now the php file "getCode.php"
(only as example, depends on your way of connecting and library (mysqli, PDO, ...)
1. Connect to the database
2. query the table:
"SELECT vouchercode from voucher WHERE status=0 limit 1" (So you get always only one row with the first not used vouchercode)
3, Save the vouchercode to $myCode=
4. Update the table; set the status of this vouchercode to "used" =1)
"UPDATE voucher SET status=1 WHERE vouchercode=$myCode";

5. echo the vouchercode
echo $myCode;


which is really the next one in the database.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The following user(s) said Thank You: tpartner

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!