🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Learn_web_development › Extensions › Forms › Form_validation
Client-side form validation - Learn web development | MDN
Even if your form is validating ... that you'll encounter on the web: HTML form validation HTML form attributes can define which form controls are required and which format the user-entered data must be in to be valid....
🌐
W3Schools
w3schools.com › js › js_validation.asp
W3Schools.com
HTML form validation can be done by JavaScript.
Discussions

Form Validation - What method do you use these days?
react hook form + zod More on reddit.com
🌐 r/webdev
29
24
February 9, 2023
HTML Form Validation is heavily underused
Nice article. Small suggestion: I'd add a section about always validating form data on server side, too, as all client side checks can be circumvented by a bad actor. More on reddit.com
🌐 r/webdev
34
157
October 28, 2024
html - HTML5 form validation without Javascript validation - Stack Overflow
I recently approached the new (for me) topic of HTML5 form validation. I tested it with success, but I'm still quite confused on how and why to use it. Let me try to explain with a simple example. ... More on stackoverflow.com
🌐 stackoverflow.com
Best JavaScript Form Validation Libraries

not really sure what will you do with that and why you even need it. There is required html tag, and anyway proper validation should be done in backend...

More on reddit.com
🌐 r/webdev
4
20
June 28, 2014
🌐
W3C
w3.org › WAI › tutorials › forms › validation
Validating Input | Web Accessibility Initiative (WAI) | W3C
Note: Several of these HTML5 input ... and validate the input. They include: maxlength defines the maximum length of a text field. min and max define the minimum and maximum of number and range fields. steps defines in what steps number and range fields can be incremented and decremented. The HTML5 pattern attribute allows the use of regular expressions to specify custom formats for the ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Guides › Constraint_validation
Using HTML form validation and the Constraint Validation API - HTML | MDN
HTML5 introduced new mechanisms for forms: it added new semantic types for the element and constraint validation to ease the work of checking the form content on the client side. Basic, usual constraints can be checked, without the need for JavaScript, by setting new attributes; more complex ...
🌐
W3Schools
w3schools.com › html › html_form_attributes.asp
HTML Input Attributes
The value of a read-only input field will be sent when submitting the form!
Find elsewhere
🌐
GeeksforGeeks
geeksforgeeks.org › html › how-to-validate-input-field-in-the-html-form
How To Validate Input Field In The HTML Form? - GeeksforGeeks
December 1, 2025 - A simple HTML form with various input fields to collect user data. First Name and Last Name: Text input fields with required validation and minimum character length.
🌐
W3C
validator.w3.org
The W3C Markup Validation Service
W3C's easy-to-use markup validation service, based on SGML and XML parsers.
🌐
Educative
educative.io › answers › form-validation-with-html-and-css
Form validation with HTML and CSS
Place the code in appropriate files and open the HTML file in a web browser. Following is an example of a form that allows users to input their name, email, and password. The form includes basic validation to ensure that the entered data is valid and meets certain criteria.
🌐
Reddit
reddit.com › r/webdev › form validation - what method do you use these days?
r/webdev on Reddit: Form Validation - What method do you use these days?
February 9, 2023 -

I’m wondering what methods most people use for form validation these days.

I haven’t built a contact form in a while and I am updating a React front end with a form that was built using react-bootstrap. I need to add a ’Website’ input field to the form in case the user wants to include their website in their contact information. The old/existing form used html validation, but <input type=‘url’ /> requires the user to type ‘http://‘, which seems a bit annoying for the average non-tech person entering their website address. Also, <input type=‘email’ /> only requires an ‘@‘ with some text after it and does not require a domain such as ‘.com’, ‘.net’, etc.

So I am wondering…what do most do for validation?

  • Plain HTML validation

  • HTML validation with some sort of check and then prepending or appending when necessary

  • <form noValidate /> and a completely separate logic for front end validation

  • Something else

🌐
CSS-Tricks
css-tricks.com › form-validation-ux-html-css
Form Validation UX in HTML and CSS | CSS-Tricks
September 16, 2021 - I don’t think it would be possible to get the text of the message or check that the message has appeared because as I understood it doesn’t have any separate html markup on the page. ... The requirements div has max-height: 0 as initial state and max-height > 0 on invalid input+focus. That’s testable. What’s already testable is the required attribute itself, populate or remove all other fields and do a scripted submit. I have to admit I don’t have much experience with selenium and there are probably better ways to check. ... Great stuff! Keep in mind that any validation done client-side can be disabled.
🌐
Cloud Four
cloudfour.com › thinks › progressively-enhanced-form-validation-part-1-html-and-css
Progressively Enhanced Form Validation, Part 1: HTML and CSS – Cloud Four
September 5, 2023 - Some of us have relied on JavaScript-only solutions to handle client-side form validation in the past (/me slowly raises hand…), but as it turns out, most of these built-in features have been around for over a decade! HTML5 introduced new mechanisms for forms: it added new semantic types for the <input> element and constraint validation to ease the work of checking the form content on the client side.
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › forms › validation
Validation · Bootstrap v5.0
Here’s how form validation works with Bootstrap: HTML form validation is applied via CSS’s two pseudo-classes, :invalid and :valid.
🌐
The Odin Project
theodinproject.com › lessons › node-path-intermediate-html-and-css-form-validation
Form Validation | The Odin Project
With the maximum length validation, ... value. Try this for yourself in the example above. HTML allows us to apply as many validations as we wish to a form control....
🌐
The Art of Web
the-art-of-web.com › html › html5-form-validation
HTML: HTML5 Form Validation Examples
For inputs that are both required and 'valid' you can use the following: <style> input:required:valid { /* insert your own styles for valid form input */ } </style> Some of the articles below, particularly the first two, provide other style/scripting options and solutions for supporting older browsers. As shown above, once you've added HTML5 attributes to your form elements, they can be easily styled using CSS so that each input field is clearly marked as valid or invalid.
🌐
DhiWise
dhiwise.com › post › html-form-validation-techniques-tips-and-tools
HTML Form Validation: Techniques, Tips, and Tools
July 10, 2024 - When users submit forms with errors, ... form validation primarily involves checking the data entered into form elements to ensure it conforms to specific rules before the form is submitted....
🌐
Reddit
reddit.com › r/webdev › html form validation is heavily underused
r/webdev on Reddit: HTML Form Validation is heavily underused
October 28, 2024 - I've seen front-end form validation that just pulls out values using query selectors and does everything by hand, for example. I wouldn't be surprised if a lot of component libraries do that. ... No it’s not. The problem with html form validation is that it as soon as you need any unique form behavior or more advanced validation, it doesn’t work.
🌐
Vue.js
v2.vuejs.org › v2 › cookbook › form-validation.html
Form Validation — Vue.js
In this version, we always prevent the form from submitting (which, by the way, could be done in the HTML with Vue as well). You can see a basic check on this.name being empty, and then we hit the API. If it’s bad, we add an error as before. If it’s good, right now we do nothing (just an alert), but you could navigate the user to a new page with the product name in the URL, or do other actions as well. You can run this demo below: See the Pen form validation 4 by Raymond Camden (@cfjedimaster) on CodePen.
🌐
GeeksforGeeks
geeksforgeeks.org › html › how-to-create-form-validation-by-using-only-html
How to create form validation by using only HTML ? - GeeksforGeeks
July 12, 2025 - <!DOCTYPE html> <html lang="en"> <head> <title>Form</title> </head> <body> <p>This is a form</p> <form> <p>Name:</p> <input type="text" required> <p>Email:</p> <input type="email" required> <p>Address:</p> <input type="text" required> <br> <button style="margin-top: 5px;"> Submit </button> </form> </body> </html>
Top answer
1 of 6
2

In other words, the HTML5 validation is only a visual artifact; it does not prevent the form submission.

It's not how it is supposed to work. By design, HTML5 validation should prevent the incorrectly filled form from submission. And it does — in most browsers. Unfortunately, there is a bug in Safari that leads to the behavior you described. So until this bug if fixed, yes, you might need to validate the form with JS, too, but it's not because of the nature of HTML5 validation, only because of the lack of its support in Safari.

2 of 6
2
<form method="GET" action="Your Action Page" id="contact form">
<div class="form-group">
<label>Name</label>
<input type="text" name="name" placeholder="name" id="name" class="form-control" required="true" pattern="[a-zA-z]+">
</div>

<div class="form-group">
<label>Email</label>
<input type="email" name="email" id="email" placeholder="email" class="form-control" required="true" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$">
</div>

<div class="form-group">
<label>Mobile No:</label>
<input type="tel" name="number" id="number" placeholder="Phone No"pattern="^\d{10}$" required="true" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" onkeydown="if(this.value.length==10 &amp;&amp; event.keyCode!=8 &amp;&amp; event.charCode != 9 &amp;&amp; event.which != 9 ) return false">
</div>

<div class="submit-area">
<input type="submit" id="submit-contact" name="submit" class="btn-alt" value="Send Message">
<div id="msg" class="message"></div>
</div>
</form>