Ciao,
mi permetto di scriverti se potessi aiutarmi... lo script di seguito non va.. lo ha rivisto tu...
la funzione di sicurezza da te consigliata Filtro HTML per XSS: è disattivata, l'id della mia domanda è 2248 e modificato come hai indicato... ma scelta la provincia carica tutti i comuni...
Versione Limesurvey Versione 2.72.3+171020
PUOI PER PIACERE AIUTARMI?GRAZIE
<span style="font-size:20px;"><small>Attualmente in quale provincia e comune vive?</small></span><br />
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('.array-flexible-duel-scale .dropdown-item select').each(function(i) {
if($('option[selected="selected"]', this).length == 0) {
$(this).prepend('<option value="">Please choose...</option>');
$(this).val('');
}
});
selectFilterDualScale({2248});
});
/*
Copyright 2012 Denis Chenu for <
www.sondages.pro
>
Distributed under MIT licence
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Luciano Fanfoni - lfanfoni@gmail.com
Modifiche per compatibilità versioni 2.7X
*/
/* Function to filter the second part of an Array dual scale (with dropdown attribute) by the first part
var qID : the number of question to filter
*/
function selectFilterDualScale(qID){
$(document).ready(function(){
if($("#question"+qID).hasClass('array-flexible-duel-scale')){
//modifiche Steve
$(this).find("col.ddarrayseparator").attr('width',"2%");
$(this).find("th.th-14").attr('width','50%');
$(this).find("th.th-15").attr('width','50%');
// Fix width of columns - vecchio di Denis
/*answertextwidth=$(this).find("col.answertext").attr('width').replace("%","");
$(this).find("col.ddarrayseparator").attr('width',"2%");
ddarrayseparatorwidth=$(this).find("col.ddarrayseparator").attr('width').replace("%","");
var newwidth=(100-answertextwidth*1-ddarrayseparatorwidth*1)/2;
$(this).find("col.dsheader").attr('width',newwidth+'%');*/
//RIPRENDE IL VECCHIO
/*modifica oreslaS per la versione Versione 3.3.1+180214
$("#question"+qID+" table.questions-list tbody tr").each(function(index){
prima era $("#question"+qID+" table.question tbody tr").each(function(index){*/
$("#question"+qID+" table.questions-list tbody tr").each(function(index){
$(this).find("select").each(function(){
//$(this).attr('id',$(this).attr('id').replace('#',"_"));
});
var idSelectFiltering = jqSelector($(this).find("select").eq(0).attr('id'));
var idSelectFilter = jqSelector($(this).find("select").eq(1).attr('id'));
var idNewSelectFilter = jqSelector('select'+qID+'_'+index);
//NUOVO DI STEVE
var NewSelectElement = "<select id='"+idNewSelectFilter+"' class='form-control'><option value=''>"+$("#"+idSelectFilter+" option[value='']:first").text()+"</option></select>";
/* VECCHIO SCRIPT DI DENIS
var NewSelectElement = "<select id='"+idNewSelectFilter+"'><option value=''>"+$("#"+idSelectFilter+" option[value='']:first").text()+"</option></select>";*/
//RIPRENDE DENIS
$("#"+idSelectFilter).hide();
$("#"+idSelectFilter).after(NewSelectElement);
$("#"+idSelectFiltering).change(function(){
$("#"+idSelectFilter).val('');
$('#'+idNewSelectFilter).val('');
var valuefilter=$(this).val().substring(0, $(this).val().length - 3);
$('#'+idNewSelectFilter+' option').not(':first').remove();
if($(this).val()==""){
$('#'+idNewSelectFilter).hide();
}else{
$('#'+idNewSelectFilter).show();
$("#"+idSelectFilter).find('option').each(function(){
if($(this).attr('value').substring(0, $(this).attr('value').length - 3)==valuefilter){
$(this).clone().appendTo('#'+idNewSelectFilter);
}
});
}
});
$("#"+idNewSelectFilter).change(function(){
$('#'+idSelectFilter).val($(this).val());
saveval=$('#'+idSelectFiltering).val();
$('#'+idSelectFilter).trigger('change');
if($(this).val()==""){
$('#'+idSelectFiltering).val(saveval);
$('#'+idSelectFiltering).trigger('change');
$('#'+idSelectFilter).val($(this).val(""));
}
});
if($("#"+idSelectFiltering).val()!=''){
//if($("#"+idSelectFiltering+' option[selected="selected"]').length != 0){
var valuefilter=$("#"+idSelectFiltering).val().substring(0, $("#"+idSelectFiltering).val().length - 3);
$('#'+idSelectFilter+' option').each(function(){
if($(this).attr('value').substring(0, $(this).attr('value').length - 3)==valuefilter){
$(this).clone().appendTo('#'+idNewSelectFilter);
}
});
if($("#"+idSelectFilter).val()!=''){
$('#'+idNewSelectFilter).val($("#"+idSelectFilter).val());
}
}else{
$('#'+idNewSelectFilter).hide();
}
});
}
});
}
function jqSelector(str) {
return str.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
}
</script>
--
Boschi Diegodiegoboschi@gmail.comskype boschi.diego
+39.391.37.98.604