Hi,
I do try some things with chart.js to automate reports after filling the survey.
I put some source code in html and java script in the end message.
It works, but only after I refresh one time the page.
If I put the same source code in the welcome message it works without refreshing (unfortunately I would not have the result of the variables before the people fill the survey

).
Code:
<p align="left"><b><span style="font-size: 32px; margin: 21px 0;">JS RADAR UND BEDINGTE TEXTAUSGABE</span></b></p>
<div style="width:70%;"><canvas height="400" id="myChart3" width="400"></canvas></div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script><script type="text/javascript">
//VARIABLES
var auswahl = 1;
var array_titel = ["TITEL0","titel1"];
var array_inhalt = ["INHALT0: Das ist Text mit dem Index 0","INHALT1: Dieser Text hat Index 1"];
var array_profil = [[1,2,3,4,5],[5,4,3,2,1]];
var array_bezeichnungen = [["elegant","stilvoll","charmant","boheme","klassisch"],["eklig","ranzig","stinkend","unangenehm","gammlig"]];
var titel = array_titel[auswahl];
var inhalt = array_inhalt[auswahl];
// RADAR
var ctx = document.getElementById("myChart3");
var myChart = new Chart(ctx, {
scaleStartValue: 0,
type: 'radar',
data: {
labels: array_bezeichnungen[auswahl],
datasets: [{
label: 'RADAR',
data: array_profil[auswahl],
borderColor: ['rgba(020,150,020,1)']
}]
},
options: {
scales: {
ticks: {
beginAtZero: true,
}
}
}
});
</script>
<p align="left"><b><span style="font-size: 28px; margin: 21px 0;">Das ist <script type="text/javascript">document.write(titel);</script> mit <script type="text/javascript">document.write(inhalt);</script></span></b></p>
I added a link to show you what happens in the following three cases:
1.) Code in welcome message ==> works
2.) Code in equation ==> does work after refresh
3.) Code in end message ==> does work after refresh
www.uebernimm-zukunft.org/lime/index.php...778?lang=de-informal
I do not want to expect from the participants to refresh the page so they get the results.
So what do I do wrong (sorry to all experts - I am not a programmer - I just copy and paste code)?
Thanks a lot in advance!!!
Steffen