Check out the LimeSurvey source code on GitHub!

Show totals zero default

More
5 years 4 months ago #66064 by TAdams
I have an array (text) question type with a show totals for rows column. The total textboxes include a zero as the default value. I need this textbox value to default to null. Hiding the zero is fine. Any ideas?

Thank you in advance.

Please Log in to join the conversation.

More
5 years 4 months ago #66067 by Mazi
You can overwrite the displayed "0" value by using some Javascript to fill the text field with a different or a blank value.
Have a look at manual -> workarounds ->JavaScript. There are several examples on how to fill a text field. You just need to take care to assign the correct field ID.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 4 months ago #66093 by tpartner
Add the following to the end of template.js. Note that this will affect all array questions showing totals. You could add a question ID to the selector to make it question-specific.
	$(document).ready(function() {
 
		$('.array-multi-flexi-text table.show-totals td.total input[type="text"], .array-multi-flexi-text table.show-totals tr.total input[type="text"]').each(function(i){ 
			if($(this).val() == 0) {
				$(this).val('');
			}
		});
	});

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 4 months ago #66248 by TAdams
Tony thank you so much. This works perfectly. You just made my life so much easier! :laugh:

Please Log in to join the conversation.

More
5 years 4 months ago #66271 by Mazi
You're welcome!

If our hints have been helpful and you enjoy limesurvey please consider a donation to the team .
We do all this in our free time and you don't have to pay a penny for this software.

Without your help we can't keep this project alive.


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form