mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
chore(curriculum): update form validation lecture and transcript (#59174)
This commit is contained in:
parent
28b8555ab7
commit
ab256b2156
@ -2,7 +2,7 @@
|
||||
id: 672a4ce6dab9eb735828b48b
|
||||
title: What Is Client-Side Form Validation in HTML Forms, and What Are Some Examples?
|
||||
challengeType: 11
|
||||
videoId: isHriKH6a34
|
||||
videoId: Mt-e0DpxGXE
|
||||
dashedName: what-is-client-side-form-validation-in-html-forms
|
||||
---
|
||||
|
||||
@ -34,7 +34,7 @@ One common example of built-in form validation is to use the `required` attribut
|
||||
|
||||
When the user clicks on the `Submit Form` button without supplying an email address, they will be alerted that the field is required and the form will not be submitted. Each browser will have its own set of styles for showing this alert message. Another advantage of using the email input, is that email inputs have some basic validation to ensure correctly formatted email addresses. It is important to note that browsers only check for basic validation for standard email addresses. It is up to you to add additional layers of validation, which you will learn about in later modules.
|
||||
|
||||
Other forms of validation for email inputs are to use the `size`, `minlength` and `maxlength` attributes. Here is an example using the extra validation:
|
||||
Other forms of validation for email inputs are to use the `minlength` and `maxlength` attributes. Here is an example using the extra validation:
|
||||
|
||||
```html
|
||||
<form action="">
|
||||
@ -44,7 +44,6 @@ Other forms of validation for email inputs are to use the `size`, `minlength` an
|
||||
type="email"
|
||||
name="email"
|
||||
id="email"
|
||||
size="32"
|
||||
minlength="4"
|
||||
maxlength="64"
|
||||
/>
|
||||
@ -52,7 +51,7 @@ Other forms of validation for email inputs are to use the `size`, `minlength` an
|
||||
</form>
|
||||
```
|
||||
|
||||
The `size` attribute is used to set the physical size for the input container. The `minlength` and `maxlength` attributes are used to set the minimum and maximum length in characters for the email input. If you don't include the minimum length or exceed the max length of characters, the browser will show an alert message.
|
||||
The `minlength` and `maxlength` attributes are used to set the minimum and maximum length in characters for the email input. If you don't include the minimum length or exceed the max length of characters, the browser will show an alert message.
|
||||
|
||||
# --questions--
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user