- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
istewart6 wrote: Great, thanks. I'll look into php scripts to handle this.
To answer your question, the codes are predefined which is why I wanted to upload a single file containing all the codes. You can generate them using an API but it's a bit complicated.
<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>
<?php $codes = array ( "aaaaaa", "bbbbbb", "cccccc", ... "yyyyyy", "zzzzzz" ); $numberOfCodes=count($codes)-1; $random=rand(0,$numberOfCodes); echo ($codes[$random]); ?>