- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Mancata associazione Provincia/Comune
- diegoboschi
- Offline
- New Member
Less
More
4 years 1 month ago #194525
by diegoboschi
Replied by diegoboschi on topic Mancata associazione Provincia/Comune - aiuto versione Versione 2.72.3+171020
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
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
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12790
- Thank you received: 3940
4 years 1 month ago #194527
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Mancata associazione Provincia/Comune - aiuto versione Versione 2.72.3+171020
Buongiorno
ecco un esempio nella versione 2.73.
Non modificare questo codice
selectFilterDualScale({QID});
{QID} è un segnaposto di sistema; sarà sostituito automaticamente
Joffm
ecco un esempio nella versione 2.73.
Non modificare questo codice
selectFilterDualScale({QID});
{QID} è un segnaposto di sistema; sarà sostituito automaticamente
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: diegoboschi
The topic has been locked.
- diegoboschi
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
4 years 1 month ago #194549
by diegoboschi
Replied by diegoboschi on topic Mancata associazione Provincia/Comune - aiuto versione Versione 2.72.3+171020
Numero 1!!! ti posso inviare la domanda in lsq in modo che potessi correggerla pulendo il codice? lasciando ovviamente i tag dei tuoi riferimenti
Se mi lasci una mail perchè è 2,8 Mb
GRANDE!!!
Se mi lasci una mail perchè è 2,8 Mb
GRANDE!!!
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12790
- Thank you received: 3940
4 years 1 month ago - 4 years 1 month ago #194550
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Mancata associazione Provincia/Comune - aiuto versione Versione 2.72.3+171020
È solo necessario copiare il javascript dal mio esempio (senza modifiche).
E nota i codici delle opzioni di risposta.
L'invio di una domanda di queste dimensioni non ha senso.
Sono sufficienti solo alcune opzioni di esempio.
Joffm
E nota i codici delle opzioni di risposta.
L'invio di una domanda di queste dimensioni non ha senso.
Sono sufficienti solo alcune opzioni di esempio.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 years 1 month ago by Joffm.
The following user(s) said Thank You: lfanfoni, diegoboschi
The topic has been locked.
- diegoboschi
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
4 years 1 month ago #194562
by diegoboschi
Replied by diegoboschi on topic Mancata associazione Provincia/Comune - aiuto versione Versione 2.72.3+171020
Ciao,
allora... ho copiato il codice (infatti importanto restituiva un errore per la lingua), ma...
La tua survey di esempio allegata importata funziona perfettamente.... mentre la mia domanda no.....
le province le ho inserite così
mentre così i comuni... mi sembrava di rispettare la tua logica... che dici? puoi aiutarmi? GRAZIE
allora... ho copiato il codice (infatti importanto restituiva un errore per la lingua), ma...
La tua survey di esempio allegata importata funziona perfettamente.... mentre la mia domanda no.....
le province le ho inserite così
mentre così i comuni... mi sembrava di rispettare la tua logica... che dici? puoi aiutarmi? GRAZIE
The topic has been locked.
- diegoboschi
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
4 years 1 month ago #194568
by diegoboschi
Replied by diegoboschi on topic Mancata associazione Provincia/Comune - aiuto versione Versione 2.72.3+171020
risolto pertendo da una nuova survey funzionante e importando i vecchi gruppi di domande grazie a
Luciano Fanfoni
Luciano Fanfoni
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12790
- Thank you received: 3940
4 years 1 month ago #194571
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Mancata associazione Provincia/Comune - aiuto versione Versione 2.72.3+171020
Ecco un esempio in italiano.
E anche un altro suggerimento per questa domanda
Joffm
E anche un altro suggerimento per questa domanda
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: lfanfoni, diegoboschi
The topic has been locked.