Can you explain a little bit more what you are trying to do? Because picking a name from a list is not a feature that Limesurvey has out of the box, but depending on what you are trying to actually do, there might be a fairly simple solution to this.
Help us to help you!
Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
I have one "question", where i explain a fictitious agent and the name of this agent should be randomly generated from a pre-defined list.
There is no answer to this question, just a simple text.
Place something like this in the question source. It will load the <span> element with a random name from a list defined in the "names" array.
Code:
The random name is <span class="random-name"> </span>.
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// Define the names
var names = ['Tom', 'Dick', 'Harry', 'Jane', 'Susan', 'Mary'];
// Randomize the names
shuffleArray(names);
// Load the <span> element with the random name
$('#question{QID} span.random-name').text(names[0]);
});
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}
</script>