Hi,
here a different approach.
You don't like to have the code list inside the survey.
So I took the opportunity to try an ajax call.
In a question (Q1) of type "short free text" I inserted the following script:
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
$.post('https://www.myServer.com/directory/getCode.php', function(data) {
$('#question{QID} input[type="text"]').val(data)
});
$('#question{QID}').hide();
});
</script>
The php-script "getCode.php":
Here I used a plain array to store the codes.
Code:
<?php
$codes = array (
"aaaaaa",
"bbbbbb",
"cccccc",
...
"yyyyyy",
"zzzzzz"
);
$numberOfCodes=count($codes)-1;
$random=rand(0,$numberOfCodes);
echo ($codes[$random]);
?>
Of course you can store the codes in a database and retrieve them by SQL; but the example should be short and easy.
Therefore thee are no error checks at all.
It was my first try with ajax calls in LS. So any improvement is appreciated.
Especially how to hide the question if it is in "question by question" mode.
Here I used "group by group" mode and had a second visible question in this group.
Best regards
Joffm