{"id":332,"date":"2021-01-19T11:26:16","date_gmt":"2021-01-19T16:26:16","guid":{"rendered":"http:\/\/www.joonim.org\/?p=332"},"modified":"2021-01-19T11:26:16","modified_gmt":"2021-01-19T16:26:16","slug":"qualtrics-how-to-set-the-maxlength-for-input-text","status":"publish","type":"post","link":"https:\/\/waterloobae.com\/blog\/2021\/01\/19\/qualtrics-how-to-set-the-maxlength-for-input-text\/","title":{"rendered":"[Qualtrics] How to set the maxlength for input text"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When Custom Validation is used. It can be confusing for users because error messages do not show the exact reason for the error.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The JavaScript code below can stop a respondent to type further than intended. The maximum length of the input text box below is set to 19.<\/p>\n\n\n\n<pre class=\"wp-block-syntaxhighlighter-code\">Qualtrics.SurveyEngine.addOnload(function()\n{\n\t\/*Place your JavaScript here to run when the page loads*\/\n\tjQuery(\"#\"+this.questionId+\" .InputText\").each(function () { \n   jQuery(this).attr('maxlength','19');\n});\n});<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Javascript code can be inserted as below.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/joonim.org\/wp\/wp-content\/uploads\/2021\/01\/bfe61-qualtrics_javascript.png\" alt=\"\" class=\"wp-image-336\" width=\"337\" height=\"353\"\/><figcaption class=\"wp-element-caption\">Screenshot from Qualtrics<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>When Custom Validation is used. It can be confusing for users because error messages do not show the exact reason for the error. The JavaScript code below can stop a respondent to type further than intended. The maximum length of the input text box below is set to 19. Javascript code can be inserted as [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-332","post","type-post","status-publish","format-standard","hentry","category-it-tips"],"_links":{"self":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts\/332","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/comments?post=332"}],"version-history":[{"count":0,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/posts\/332\/revisions"}],"wp:attachment":[{"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/media?parent=332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/categories?post=332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/waterloobae.com\/blog\/wp-json\/wp\/v2\/tags?post=332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}