Hi,
I am wondering if there is Javascript to display how many remaining characters are left in the character validation of an open-end/write in box so the respondent see that before getting stopped by an error message. Like twitter where it will tell you how many characters remain 0/250..
Thanks!
Javascript or Something to show remaining character limit prior to error message
Best answer by ahmedA
See if this works for you:
Qualtrics.SurveyEngine.addOnload(function()
{
//Create a placeholder to display the reminder message
char_rem = document.createElement("p");
char_rem.setAttribute("id", "char_reminder");
char_rem.setAttribute("style", "color:LightGray;");
this.getChoiceContainer().parentNode.appendChild(char_rem);
});
Qualtrics.SurveyEngine.addOnReady(function()
{
const qid = this.questionId;
document.querySelector("#QR\\\\~" + qid).oninput = function () {limited();};
function limited(){
curr_len = document.querySelector("#QR\\\\~" + qid).value.length;
//Set the max_len as an embedded data field equal to maximum length in validation options
max_len = "${e://Field/max_len}";
//Nothing will be displayed if the characters are less than 10
//If you want to always have the reminder, then delete the statement below and remove the if condition
reminder = "";
if(curr_len>10){
rem_len = max_len - curr_len;
reminder = rem_len + "/20 characters remaining";
}
document.querySelector("#char_reminder").innerText = reminder;
}
});
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
