Dynamic end message results only after refresh - why?

Plus d'informations
il y a 1 mois 2 jours #181866 par steffenschaffhausen
COM_KUNENA_MESSAGE_CREATED_NEW
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 ;-) ).
<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

https://www.uebernimm-zukunft.org/lime/index.php/558778?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

Connexion ou Créer un compte pour participer à la conversation.

LimeSurvey Partners
Plus d'informations
il y a 1 mois 2 jours #181890 par tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
Try disabling AJAX in the survey theme options.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Les utilisateur(s) suivant ont remercié: DenisChenu

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 1 mois 2 jours #181891 par steffenschaffhausen
COM_KUNENA_MESSAGE_REPLIED_NEW
Thanks a lot. Works so far. What problems do I create by disabling AJAX?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 1 mois 2 jours - il y a 1 mois 2 jours #181893 par tpartner
COM_KUNENA_MESSAGE_REPLIED_NEW
None at all. It was intended to speed up page load but is somewhat prone to causing errors.

If using the latest version, please file a bug report and give a link here so we can follow it.

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: il y a 1 mois 2 jours by tpartner.
Les utilisateur(s) suivant ont remercié: DenisChenu

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!