Skip to main content

FV Decipher Support

All the topics, resources needed for FV Decipher.

FocusVision Knowledge Base

Set a Survey Password

1:  Overview

Password entry into your survey can be done using the <text> question element, the File(..) function and a tab-delimited file. For information on using the File(..) function, click here.

2:  Single Password Only

To create a single-password entry to your survey, you will need some way of identifying respondents in order to check their password. This is usually an extraVariable like source or id.

Given the following tab-delimited file named "passwords.dat":

source           password
un1qu30n3        p4ssw0Rd123
sp3C14LuN        iluvmypuppy99
bl4hblAHB        battery_horse_staple

We can use the File() function as described in Importing External Offline Data to compare unique identifiers with a password.

For example:

<html label="Introduction" where="survey">
  <p>Welcome to the survey!</p>
  <p>On the next page, you'll be asked for your password.</p>
</html>
<suspend/>

<text label="PASS">
  <title>Please enter your password:</title>
</text>
<suspend/>

<exec when="init">
dataFile = File("passwords.dat", "source")
</exec>

<radio label="PASS_CHECK" where="execute">
  <title>HIDDEN: PASS DID MATCH SOURCE?</title>
  <exec>
respData = dataFile.get(source)

if respData and respData['password'] == PASS.val:
    PASS_CHECK.val = PASS_CHECK.yes.index
else:
    PASS_CHECK.val = PASS_CHECK.no.index
  </exec>
  <row label="yes">Yes</row>
  <row label="no">No</row>
</radio>
<suspend/>

<term cond="PASS_CHECK.no">PASS_CHECK: FAIL</term>

<note>RESPONDENT PASSED PASSWORD CHECK</note>
<html label="Welcome" where="survey">Welcome! Please "Continue".</html>

Demo

Choose any of the links below to demo the code above:

source password
user1 pass1
user2 pass2
user3 pass3
user4 pass4

You will see "Welcome! Please 'Continue'." upon successful entry.

You can use a similar technique to validate a username and password against a tab-delimited file.