- Posts: 7
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Pop up message
- MaxD
- Topic Author
- Offline
- New Member
Less
More
8 years 11 months ago #121305
by MaxD
Pop up message was created by MaxD
Hi folks,
I'm programming a survey on Limesurvey 1.91 (can't update now).
I'm having some issue with a script I wrote for the "Multiple choice with comments" type. See below :
I made it to hide some textbox and reduce the other one size.
$(document).ready(function() {
$("#answer29546X412X112951comment").hide();
$("#answer29546X412X112952comment").hide();
$("#answer29546X412X112953comment").attr('size',2);
$("#answer29546X412X112954comment").attr('size',2);
$("#answer29546X412X112955comment").attr('size',2);
$("#answer29546X412X112956comment").attr('size',2);
$("#answer29546X412X112957comment").hide();
});
</script>
Now my issue is that if the respondent check more than one question a message pop with the javascript on it.
Is it possible to change or remove this popup message ?
Thank you already (and sorry for my english) !
Max
I'm programming a survey on Limesurvey 1.91 (can't update now).
I'm having some issue with a script I wrote for the "Multiple choice with comments" type. See below :
I made it to hide some textbox and reduce the other one size.
$(document).ready(function() {
$("#answer29546X412X112951comment").hide();
$("#answer29546X412X112952comment").hide();
$("#answer29546X412X112953comment").attr('size',2);
$("#answer29546X412X112954comment").attr('size',2);
$("#answer29546X412X112955comment").attr('size',2);
$("#answer29546X412X112956comment").attr('size',2);
$("#answer29546X412X112957comment").hide();
});
</script>
Now my issue is that if the respondent check more than one question a message pop with the javascript on it.
Is it possible to change or remove this popup message ?
Thank you already (and sorry for my english) !
Max
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10117
- Thank you received: 3597
8 years 11 months ago #121310
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Pop up message
I don't understand why there would be a pop-up but try placing your script in the group description or hide/modify those text inputs with CSS.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- MaxD
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
8 years 11 months ago #121312
by MaxD
Replied by MaxD on topic Pop up message
There is a pop up because I put a restriction on how many answer the respondent can choose, and you can see in the file attached what's actually happening.
Attachments:
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10117
- Thank you received: 3597
8 years 11 months ago #121313
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Pop up message
Did you try my suggestions?
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- MaxD
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
8 years 11 months ago #121314
by MaxD
Replied by MaxD on topic Pop up message
I tried to place the script in the group description but it doesn't work, and the question looks like nothing change (a classic Multiple choice + comments).
And I have no idea how to do this in CSS.
Thank you for your help !
And I have no idea how to do this in CSS.
Thank you for your help !
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
8 years 11 months ago #121315
by first
Survey Designer and Programmer
Replied by first on topic Pop up message
Did you wrap your code inside <script> tag?
Survey Designer and Programmer
The topic has been locked.
- MaxD
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
8 years 11 months ago - 8 years 11 months ago #121316
by MaxD
Replied by MaxD on topic Pop up message
Yes I did, just messed with my copy/paste :blush:
I think the popup is coded in the way that it rewrites the question but doesn't recognize the javascript.
Here is the function that my navigator debog mode find:
<script type='text/javascript'>
<!--
function limitmaxansw_11295(me)
{
max=1
count=0;
if (max == 0) { return count; }
if (document.getElementById('answer29546X412X112951').checked) { count += 1; }
if (document.getElementById('answer29546X412X112952').checked) { count += 1; }
if (document.getElementById('answer29546X412X112953').checked) { count += 1; }
if (document.getElementById('answer29546X412X112954').checked) { count += 1; }
if (document.getElementById('answer29546X412X112955').checked) { count += 1; }
if (document.getElementById('answer29546X412X112956').checked) { count += 1; }
if (document.getElementById('answer29546X412X112957').checked) { count += 1; }
if (count > max)
{
alert('Veuillez choisir au plus 1 réponses pour la question \u0022A quelle fréquence effectuez-vous ce déplacement ?\r\n\r\n\r\n \r\n $(document).ready(function() { \r\n \r\n \r\n $(\u0022#answer29546X412X112951comment\u0022).hide();\r\n $(\u0022#answer29546X412X112952comment\u0022).hide();\r\n $(\u0022#answer29546X412X112953comment\u0022).attr(\'size\',2);\r\n $(\u0022#answer29546X412X112954comment\u0022).attr(\'size\',2);\r\n $(\u0022#answer29546X412X112955comment\u0022).attr(\'size\',2);\r\n $(\u0022#answer29546X412X112956comment\u0022).attr(\'size\',2);\r\n $(\u0022#answer29546X412X112957comment\u0022).hide();\r\n \r\n });\r\n \r\n\u0022');
var commentname='answer'+me.name+'comment';
if (me.type == 'checkbox') {
me.checked = false;
var commentname='answer'+me.name+'comment';
}
if (me.type == 'text') {
me.value = '';
if (document.getElementById(me.name + 'cbox') ){
document.getElementById(me.name + 'cbox').checked = false;
}
}document.getElementById(commentname).value='';
return max;
}
}
//-->
</script>
I think the popup is coded in the way that it rewrites the question but doesn't recognize the javascript.
Here is the function that my navigator debog mode find:
<script type='text/javascript'>
<!--
function limitmaxansw_11295(me)
{
max=1
count=0;
if (max == 0) { return count; }
if (document.getElementById('answer29546X412X112951').checked) { count += 1; }
if (document.getElementById('answer29546X412X112952').checked) { count += 1; }
if (document.getElementById('answer29546X412X112953').checked) { count += 1; }
if (document.getElementById('answer29546X412X112954').checked) { count += 1; }
if (document.getElementById('answer29546X412X112955').checked) { count += 1; }
if (document.getElementById('answer29546X412X112956').checked) { count += 1; }
if (document.getElementById('answer29546X412X112957').checked) { count += 1; }
if (count > max)
{
alert('Veuillez choisir au plus 1 réponses pour la question \u0022A quelle fréquence effectuez-vous ce déplacement ?\r\n\r\n\r\n \r\n $(document).ready(function() { \r\n \r\n \r\n $(\u0022#answer29546X412X112951comment\u0022).hide();\r\n $(\u0022#answer29546X412X112952comment\u0022).hide();\r\n $(\u0022#answer29546X412X112953comment\u0022).attr(\'size\',2);\r\n $(\u0022#answer29546X412X112954comment\u0022).attr(\'size\',2);\r\n $(\u0022#answer29546X412X112955comment\u0022).attr(\'size\',2);\r\n $(\u0022#answer29546X412X112956comment\u0022).attr(\'size\',2);\r\n $(\u0022#answer29546X412X112957comment\u0022).hide();\r\n \r\n });\r\n \r\n\u0022');
var commentname='answer'+me.name+'comment';
if (me.type == 'checkbox') {
me.checked = false;
var commentname='answer'+me.name+'comment';
}
if (me.type == 'text') {
me.value = '';
if (document.getElementById(me.name + 'cbox') ){
document.getElementById(me.name + 'cbox').checked = false;
}
}document.getElementById(commentname).value='';
return max;
}
}
//-->
</script>
Last edit: 8 years 11 months ago by MaxD.
The topic has been locked.
- first
- Offline
- Elite Member
Less
More
- Posts: 227
- Thank you received: 36
8 years 11 months ago #121317
by first
Survey Designer and Programmer
Replied by first on topic Pop up message
Also move your code as suggested by tpartner.
Survey Designer and Programmer
The topic has been locked.
- MaxD
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
8 years 11 months ago #121318
by MaxD
Replied by MaxD on topic Pop up message
If I do so, my code doesn't work anymore
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10117
- Thank you received: 3597
8 years 11 months ago #121319
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Pop up message
Try placing the JavaScript in the "Help" section.
CSS:
CSS:
Code:
#answer29546X412X112951comment, #answer29546X412X112952comment, #answer29546X412X112957comment { display: none !important; } #answer29546X412X112953comment, #answer29546X412X112954comment, #answer29546X412X112955comment, #answer29546X412X112956comment { width: 18px !important }
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- MaxD
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
8 years 11 months ago #121320
by MaxD
Replied by MaxD on topic Pop up message
I tried the CSS code in the "Help" section and the "Question" section but I'm not sure where I have to insert it ? (Never used CSS before).
After the $(document).ready(function() { and before }); ?
After the $(document).ready(function() { and before }); ?
The topic has been locked.
- tpartner
- Away
- LimeSurvey Community Team
Less
More
- Posts: 10117
- Thank you received: 3597
8 years 11 months ago #121321
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Pop up message
JavaScript would go in the "Help" section.
CSS would go at the end of template.css - manual.limesurvey.org/The_template_edito...g_questions_with_CSS
CSS would go at the end of template.css - manual.limesurvey.org/The_template_edito...g_questions_with_CSS
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: MaxD
The topic has been locked.