Added a check for a defined maxlength on the input. If a defined maxlength exists, the character string is limited to the input's maxlength.