You should adopt one of the JS frameworks out there and follow the documentation how to do forms and best practices around them. Frameworks will provide you with functionality like form validation, error processing and premade CSS / CSS Animations. No professional developer writes forms from scratch any more. Why to try to re-invent the wheel? If you are in Laravel look into Bootstrap 4 but also consider other great alternatives if use are using Vue.js. The one to point out is Vuetify. Out of the box support for very nice looking forms.
Also check out Jeffrey's tutorials on Laracasts.com. He actually has tutorial where he builds a simple form validation class from scratch. It should give you a basic understanding what you are looking for.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community