Put this in the onKeyUp or onKeyDown event: textLimit(this, 128); Add this function to the JSHeader: function textLimit(fld, maxlen) { if (fld.value.length > maxlen + 1) if (fld.value.length > maxlen) fld.value = fld.value.substring(0, maxlen); }