Anciennes révisionsLiens de retourExporter en PDFHaut de page Share via Share via... Twitter LinkedIn Facebook Pinterest Telegram WhatsApp Yammer RedditDerniers changementsSend via e-MailImprimerPermalien × JS: Faire des tests dans un quiz? limesurvey astuce — Fred Radeff 2008/04/10 15:11 ci-dessous le code (simplifié) d'une question avec 3 checkbox <input class='checkbox' type='checkbox' name='48872X68X472c1' id='answer48872X68X472c1' value='Y' onclick='checkconditions(this.value, this.name, this.type)' onchange='modfield(this.name)' /> <input class='checkbox' type='checkbox' name='48872X68X472c2' id='answer48872X68X472c2' value='Y' onclick='checkconditions(this.value, this.name, this.type)' onchange='modfield(this.name)' /> <input class='checkbox' type='checkbox' name='48872X68X472c3' id='answer48872X68X472c3' value='Y' onclick='checkconditions(this.value, this.name, this.type)' onchange='modfield(this.name)' /> Mettre dans l'aide: <script language="JavaScript"> function checkconditions(){ choix1=document.getElementById('answer48872X68X472c1').checked; choix2=document.getElementById('answer48872X68X472c2').checked; if(choix1==true&&choix2==true) { alert("choix incompatible!"); } } </script> Attention, il y a des conditions: pour réagir au click (ici d'un checkbox), on court-circuite la fonction intégrée à LimeSurvey checkconditions(); si on veut que les fonctions intégrées à LimeSurvey soient fonctionnelles après ce court-circuitage (p.ex. si on veut que la question suivante ait une valeur “autre” qui fasse apparaître un champ de texte <INPUT>), il FAUT soit: finir la page courante par cette question “court-circuitée” découper le questionnaire par groupe, et finir le groupe courant par cette question “court-circuitée” découper le questionnaire par question How to use Script (eg. JavaScript etc.) If you want to use javascript within Limesurvey you have to disable a security filter before you can add your javascript in source code mode: FIRST, some info from config-default.php: //$filterxsshtml__ // Enables filtering of suspicious html tags in survey, group, questions__ // and answer texts in the administration interface__ // Only set this to false if you absolutely trust the users__ // you created for the administration of LimeSurvey and if you want to__ // allow these users to be able to use Javascript etc. .__ $filterxsshtml = true; info/limesurvey/testjs.txt Dernière modification : 2019/10/02 07:56de radeff S'identifier