Support Article
Spell check extending words past textbox/area max size
SA-32710
Summary
In Chrome browser, spell check does not extend the size of a textarea or box when correcting misspelled words.
However, in Internet Explorer, which is used, spell check will extend the number of characters in a textarea or box passed the maximum when correcting misspelled words.
Error Messages
Not Applicable
Steps to Reproduce
- Put a maximum size on a textarea/box and then misspell some stuff up to the max.
- Right-click on the red squiggly underline misspelled words and fix them.
Root Cause
This behavior difference between browsers is expected.
Resolution
Perform the following local-change:
Use the following function in the userworkform and executing it via runscript onchange/focus of the textarea to make sure that the number of characters does not exceed the maxlength even if it is accidentally set via spell-check:
<script>
window.trimTextArea = function(event){
var target = event.target;
var len = parseInt(target.getAttribute("maxlength"), 10);
if(target.value.length > len) {
//alert('Maximum length exceeded: ' + len);
target.value = target.value.substr(0, len);
return false;
}
}
</script>
window.trimTextArea = function(event){
var target = event.target;
var len = parseInt(target.getAttribute("maxlength"), 10);
if(target.value.length > len) {
//alert('Maximum length exceeded: ' + len);
target.value = target.value.substr(0, len);
return false;
}
}
</script>
Published February 8, 2017 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.