Welcome, Guest
Username: Password: Remember me

TOPIC: Limit char in 'Other' textfield

Limit char in 'Other' textfield 1 year 7 months ago #91478

  • mimi
  • mimi's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
hello...

i want to know if whether i can limit char in 'other/lain-lain' textfield.
here i'd attached too the pic of my design
Attachments:
The administrator has disabled public write access.

Aw: Limit char in 'Other' textfield 1 year 7 months ago #91503

  • ResearchOnBlogs
  • ResearchOnBlogs's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 184
  • Thank you received: 16
  • Karma: 8
Hi,
I would use a JQuery plugin/function for this.

Cheers Kai

research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
This email address is being protected from spambots. You need JavaScript enabled to view it.
The administrator has disabled public write access.

Re: Aw: Limit char in 'Other' textfield 1 year 7 months ago #91516

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4190
  • Thank you received: 787
  • Karma: 359
If you want to do it for a single question, add this to the question source:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
		$('#question{QID} input[type="text"][id$="other"]').attr('maxlength', 10);
	});
</script>

If you want to do it for all questions in the survey, add this to the end of template.js (this example is for the multiple options question type):
$(document).ready(function(){
	$('.multiple-opt input[type="text"][id$="other"]').attr('maxlength', 10);
});
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: Limit char in 'Other' textfield 1 year 7 months ago #91589

  • mimi
  • mimi's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Thank You s0 much for helping Mr.
The administrator has disabled public write access.

Re: Limit char in 'Other' textfield 1 year 7 months ago #91596

  • mimi
  • mimi's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 32
  • Karma: 0
Okay... that is for multiple option. but how if the type is List (flexible labels)(dropdown)

tQ
The administrator has disabled public write access.

Re: Limit char in 'Other' textfield 1 year 7 months ago #91631

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4190
  • Thank you received: 787
  • Karma: 359
Of course, it would be too much to expect consistency in the IDs :laugh:
$(document).ready(function(){
	$('.list-dropdown input[type="text"][id^="othertext"]').attr('maxlength', 10);
});
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.126 seconds
Donation Image