Problems with a javascript on dropdownlist combined

More
3 years 7 months ago #141127 by lfanfoni
Hi there.
I've adapted a script of Denis Chenu to define two dropdown list (italian provinces and towns).
This script run well in 2.05 version, but not in 2.50 version. You can test here the 2.50.
With firebug I've found errors on these statements:
1) answertextwidth=$(this).find("col.answertext").attr('width').replace("%","");
2) ddarrayseparatorwidth=$(this).find("col.ddarrayseparator").attr('width').replace("%","");

I hope you can assist me.
Luciano

Aiutaci a far crescere la comunità italiana di LimeSurvey: vai sul forum Italiano per richieste e soluzioni citando sempre la versione usata, non scrivere in privato, suggerisci modifiche o nuove traduzioni - www.limesurvey.org/forum/italian-forum/118441

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
3 years 7 months ago #141139 by steve_81
Hi,
could you please provide a .lss export of the question.
It's difficukt to debug without it.
Greets
Steve

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #141140 by lfanfoni
Here you can find the zip file of the question (2 MB)

Aiutaci a far crescere la comunità italiana di LimeSurvey: vai sul forum Italiano per richieste e soluzioni citando sempre la versione usata, non scrivere in privato, suggerisci modifiche o nuove traduzioni - www.limesurvey.org/forum/italian-forum/118441

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #141154 by steve_81
Hi,

sorry I was in a meeting, but here we go:

The adjusting of the width is the problem, but I can offer you a solution.
Change the script of Denis to this:
// Fix width of columns
			$(this).find("col.ddarrayseparator").attr('width',"2%");
			$(this).find("th.th-14").attr('width','50%');
			$(this).find("th.th-15").attr('width','50%');
			$("#question"+qID+" table.question tbody tr").each(...
Maybe its not as smart as the origin solution.

And a design issue: A little bit further down there is var NewSelectElement, ther you add class='form-control'. The line should look like this:
var NewSelectElement = "<select id='"+idNewSelectFilter+"' class='form-control'><option value=''>"+$("#"+idSelectFilter+" option[value='']:first").text()+"</option></select>";

Hopefully it works.
The following user(s) said Thank You: lfanfoni, mzzvtr

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #141172 by lfanfoni
Yes! It works on 2.50 and 2.05 too. Here the 2.50.
Thanks a lot!
Luciano

Aiutaci a far crescere la comunità italiana di LimeSurvey: vai sul forum Italiano per richieste e soluzioni citando sempre la versione usata, non scrivere in privato, suggerisci modifiche o nuove traduzioni - www.limesurvey.org/forum/italian-forum/118441
The following user(s) said Thank You: mzzvtr

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!