It is better to restrict the user from entering invalid input and submit the form.
If the inputted data is invalid then the request is not been executed on the server-side script if added validation and the user needs to again fill the details.
If a field does not require a specific type value like – number, character, special character then stop the user from entering.
In this tutorial, I show how you can restrict keyboard character input with jQuery and JavaScript.