I have a web form that extensively uses the HTML5 type attributes. I have to submit it in JSON, so I need to prevent the actual submitting, convert FormData to JSON, and POST it using AJAX.
The thing is, I don't feel like writing the data validation myself, and I don't think I wanna add more library for the validation either.
They're nothing too advanced, just required attributes, phone number, e-mail, numbers with certain increments, etc. I'd rather let the browser validate using its own mechanisms, then when the time comes to submit my script takes over.
its quite simple actually. Depending on the type of input, each can be passed props to check like to making every field required, you just pass required to every input. min, max for numbers, type="email" to check emails, maxLength, minLength for string length checking etc. Make sure to pass the proper type too for each field. For more data, visit Inputs explaination at W3Schools. Though, all the checks should be re-done in the backend for security purposes.