Asking for help, clarification, or responding to other answers. The length property of an empty string is 0. some kind of text input and its value is too short. It allows setting min/max length rules for input validation . if you have a submit button and trying to validate all the inputs of your form at once, toggle it to true, then it will validate the field and pass the result via the "validationcallback" you provide. It still submits while the form is invalid. Validating input: Best solution Yup is a light weight JavaScript schema builder. Below JavaScript, function will check if the passed parameter is alphanumeric. Return false if the element is. (Useful when restricting the length of a username and/or password) Specifically, when user inputs more than 10 character in length, it still submits the form into database, while it should display alert. If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail: