All language subtitles for 001 Setting up Form Validation_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French Download
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In this section, we're going to focus on form validation.

Form validation is the process of checking if the input from the user is in the correct format.

For example, you may have a field for an age.

You can use validation to check if the input meets a set of criteria, you'll want to check if the value

is numeric.

It's also common to check if the number is between a minimum and maximum range.

Validation plays a role in saving resources.

Traditionally, form validation is performed on the server.

After a user fills out a form, the data is transmitted to a server before the server inserts the form

data into the database, it will validate the input.

In addition, the server may sanitize the data to prevent malicious code from executing.

Performing validation on user submitted data is a crucial step to take.

You don't want to insert improper data into the database.

There is a downside for performing validation on the server.

If the user makes a mistake, they'll have to wait for a response from the server to notify them of

their mistake.

In this day and age, most users have the expectation of immediate feedback.

On top of this, servers must allocate resources to process the request.

Performing validation on the server is costly and slow.

JavaScript has come a long way.

It's possible to perform form validation on the client.

It allows for a feedback to be immediate.

Since validation is performed on the browser, you save a lot on resources to be clear.

Validation should always be performed on the server regardless if we do it on the client, it may seem

redundant.

However, the purpose of form validation on the client is to improve user experience and save resources.

It is still possible to bypass validation if the user is smart enough.

In fact, form validation was one of the reasons why JavaScript was introduced as a language.

One of the original purposes of JavaScript was to perform form validation.

The user would receive immediate feedback.

If they made a mistake, the server wouldn't have to allocate resources since a request was never made

in the first place.

Even though the internet is faster than ever and servers are more powerful than before, it's still

a good idea to perform form validation.

It reduces the number of requests made to a server.

In the end, it's up to you.

Performing client signed form validation is optional.

All right, if you're convinced, then let's take a look at how we can perform form validation in view

by default view has minimal support for validation.

Technically, we can perform validation without a library or third party package.

The process is straightforward.

Events are used to listen for form submissions and user input before a form is submitted.

Conditions are performed against the user's input.

An error will get outputted.

If a condition fails, it's perfectly fine to use view on its own for form validation.

However, there is a problem you may need to perform validation on multiple forms.

This increases the likelihood of repetitive code.

In this instance, you may want to create a few functions that will help you manage some of the more

common and basic validation checks.

You could create this on your own, or you could use a third party library for this course.

We'll be using a third party library.

Another benefit of using a third party library is that they're usually tested to work on all browsers

and or kept up to date.

View doesn't provide any official libraries for form validation.

Instead, it recommends two options which are View LYDGATE and V validate.

In the resource section of this lecture, I provide a link to both libraries.

Both are excellent libraries.

Choosing one boils down to preference for this course we'll be using V validate.

It's more frequently updated and it's very flexible.

Let's begin the installation.

Switch over to the command line.

If you have the server running, turn it off.

Packages must be installed while the server isn't running.

After doing so, run the following command and pm i v validate.

We've successfully installed.

The library will continue in the next lecture.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.