- Posts: 53
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
((handlungsfeld_1.NAOK == "Y")) ((handlungsfeld_2.NAOK == "Y")) ... ((handlungsfeld_10.NAOK == "Y"))
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8"> function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } $(document).on('ready pjax:scriptcomplete',function(){ var arr = []; var base='{QBase}'; arr = base.split(""); arr = shuffle(arr).join('').slice(0, 3) $('#question{QID} input[type="text"]').val('#'+arr); $('#question{QID}.hide(); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Das hast Du zwar in eqUrne gemacht, benutzt aber in der Folge immer wieder eqBase.Die Mehrfachnennungsfrage möge Q1 heißen mit den Teilfragencodes „Y001“, „Y002“, „Y003“,…Dann sagen wir:Wenn die Teilfrage 1 ausgewählt wurde (Q1_Y001==“Y“), dann füge ein „A“ hinzu, sonst nichts.
Und dies für alle Teilfragen.{join(if(Q1_Y001==“Y“,“A“,““),if(Q1_Y002==“Y“,“B“,““),if(Q1_Y003==“Y“,“C“,““),…,if(Q1_Y012==“Y“,“L“,““))}Damit haben wir die Urne gefüllt.
Please Log in to join the conversation.
{str_replace(eqZahl1, "", eqUrne)}
{str_replace(eqZahl1, "", eqUrne2)}
Please Log in to join the conversation.
<script type="text/javascript" charset="utf-8"> function [url=http://www.php.net/shuffle]shuffle[/url]([url=http://www.php.net/array]array[/url]) { var currentIndex = [url=http://www.php.net/array]array[/url].length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.[url=http://www.php.net/floor]floor[/url](Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = [url=http://www.php.net/array]array[/url][currentIndex]; [url=http://www.php.net/array]array[/url][currentIndex] = [url=http://www.php.net/array]array[/url][randomIndex]; [url=http://www.php.net/array]array[/url][randomIndex] = temporaryValue; } return [url=http://www.php.net/array]array[/url]; } $(document).on('ready pjax:scriptcomplete',function(){ var arr = []; var base='{QBase}'; arr = base.[url=http://www.php.net/split]split[/url](""); arr = [url=http://www.php.net/shuffle]shuffle[/url](arr).[url=http://www.php.net/join]join[/url]('').slice(0, 3) $('#question{QID} input[type="text"]').val('#'+arr); $('#question{QID}.hide(); }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Please Log in to join the conversation.