Inhaltsverzeichnis

serialCheck()

int serialCheck(string accessCode)

The function serialCheck() reveals whether an accessCode is valid, and whether it has already been used. This function can be helpful in calling up an access code manually.

Note: Only the status of an access code can be checked with this function – the access code will not be marked as “used” at the end of the questionnaire.

Return Value

serialCheck() generates one of the following codes:

CodeMeaning
-1No access code specified
0Access code not recognized in the survey project
1Access code already used (questionnaire is thus completed)
2Questionnaire was already called up with the access code, but not completed
3Access code yet to be used

Example

The following example assumes that an access code was asked for on the previous page in the text input field “AB01_01”. The PHP code now checks whether the access code specified is valid. If not, the PHP code shows a text element as an error message, and redisplays the previous page with repeatPage

$serial = value('AB01_01');
$status = serialCheck($serial);
 
if ($status == -1) {
  repeatPage('serialVoid');
} elseif ($status == 0) {
  repeatPage('serialWrong');
} elseif ($status == 1) {
  repeatPage('serialUsed');
}