Hello,
I’d like partipants to answer “ first 2 letter of first name” & ‘first 3 letter of last name’ in the from field. How can I validate so that they can only enter 2 letters and 3 letters on that field?
![](https://uploads-us-west-2.insided.com/qualtrics-us/attachment/234e35b9-288c-4942-b83b-05c7888c1d39.png)
Hello,
I’d like partipants to answer “ first 2 letter of first name” & ‘first 3 letter of last name’ in the from field. How can I validate so that they can only enter 2 letters and 3 letters on that field?
Hi
Qualtrics.SurveyEngine.addOnload(function() {
jQuery('#'+this.questionId+' input').slice(0, 3).each(function(index) {
var maxLength;
if (index === 0 || index === 2) {
maxLength = 2;
} else {
maxLength = 3;
}
jQuery(this).on('input', function() {
var value = jQuery(this).val();
if (value.length > maxLength) {
jQuery(this).val(value.slice(0, maxLength));
}
});
});
});
Try this code.
Hope this helps!
Thank you so much! It worked kind.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.