- Posts: 2
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
The problem is that Expression Manager is parsing the quotes before the page is rendered. Try using a switch statement. Something like this (untested):How should I change my code if I want to change SQ1 depending on 'i'.
<script type="text/javascript" charset="utf-8"> var x = {numCriteria}; var table = document.getElementById("myTable"); for (var i = 0 ; i<=x-1 ; i++) { var row = table.insertRow(i); var cell1 = row.insertCell(0); var cell2 = row.insertCell(1); var cell3 = row.insertCell(2); switch(i) { case 0: cell1.innerHTML = "{Kryteriummiernik_SQ1_SQ5.shown}"; cell2.innerHTML = "{Kryteriummiernik_SQ1_SQ6.shown}"; cell3.innerHTML = "{Kryteriummiernik_SQ1_SQ7.shown}"; break; case 1: cell1.innerHTML = "{Kryteriummiernik_SQ2_SQ5.shown}"; cell2.innerHTML = "{Kryteriummiernik_SQ2_SQ6.shown}"; cell3.innerHTML = "{Kryteriummiernik_SQ2_SQ7.shown}"; break; case 2: cell1.innerHTML = "{Kryteriummiernik_SQ3_SQ5.shown}"; cell2.innerHTML = "{Kryteriummiernik_SQ3_SQ6.shown}"; cell3.innerHTML = "{Kryteriummiernik_SQ3_SQ7.shown}"; break; case 3: cell1.innerHTML = "{Kryteriummiernik_SQ4_SQ5.shown}"; cell2.innerHTML = "{Kryteriummiernik_SQ4_SQ6.shown}"; cell3.innerHTML = "{Kryteriummiernik_SQ4_SQ7.shown}"; break; } } </script>
As far as I know, here is no Expression manager variable for the array answer text strings so you'll have to hard-code those.Morover, is it possible to show the answertexts: 'Kryterium i miernik', 'sposob klasyfikacji', 'wynik' as the labels in the table?
<table id="myTable"> <thead> <th>Kryterium i miernik</th> <th>Sposob klasyfikacji</th> <th>Wynik</th> </thead> </table>
I used this solution.Morover, is it possible to show the answertexts: 'Kryterium i miernik', 'sposob klasyfikacji', 'wynik' as the labels in the table?
As far as I know, here is no Expression manager variable for the array answer text strings so you'll have to hard-code those.
<table id="myTable">
<thead>
<th>Kryterium i miernik</th>
<th>Sposob klasyfikacji</th>
<th>Wynik</th>
</thead>
</table>