Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In this lecture, we're going to validate the password fields.
We have two of them in our form.
The second field is to verify the password.
We want to check that the user is sure about their password.
VALIDATE has a rule for checking if two fields match.
We'll learn about what that rule is in a moment.
First, we'll focus on preparing the fields under the age field.
You'll find the password field will change the input field to the field component.
We'll set the name attribute to password.
Next, we'll begin adding the rules in these schema object, we'll use the following rules for the password
field required minimum, maximum.
Throughout this section, you'll notice I've been setting a minimum and maximum cap for each input,
this rule set isn't required but recommended.
Most databases will usually come with a limit on how much data can be inserted into it.
While it's not your responsibility to manage the database.
It's always good to ask or check what the limits are.
This will allow you to import those limits in your forms.
The limits I'm using are ones I use in real applications.
Feel free to follow along.
Sometimes you may need to use different limits, increase or decrease the limits as you see fit.
The next step is to work on outputting the error.
We'll use the same markup for the other input fields.
Scroll back to the password field copy and paste the markup for the error message from any other inputs
we've already validated pasted below the password field.
The name property will need to be updated to password.
We can work on the next input, same process as before the confirmed password field can be found directly
below the password field.
We'll do the same thing we did to the other components, change the input element to the field component.
Will sent the name attribute to confirm password.
Up next, we need to add the rules, we're not going to use the same rules we used for the password
field, it's not necessary to apply the same rules.
The purpose of the confirmation password field is to double check that the user correctly inputted their
password.
The rule will want to use should check if the input matches the input in the password field.
This can seem a little tricky, but luckily we validate comes with an easy to use solution.
First, we'll need to import and register the rule, open the validation file, import a rule called
confirms.
In the Insull method for the plug in will add the confirmed rule with the defined rule function.
The confirmed rule will check if the value inside the current input matches a value in another input,
let's learn how to use it.
Switch back to the authentication component file.
Let's go to these schema object in our data function.
Will aren't the confirmed rule to the confirmed password field?
The confirmed rule requires you pass in the name of the field, the current input should match against
will set this rule to at password.
The value must correspond to the name we assigned to the field component with the value we're checking
against the at symbol is required.
It'll tell validate to search for a field with this name.
This rule will tell validate to search for a field component with the name password.
The last thing we'll need to do is at the ER, let's scroll back up to the template.
We'll copy the error message component from one of the previous fields.
Then we'll paste it below the confirmed password field.
We'll change the expression to password confirm.
We're finished.
Let's open the form in the browser.
We'll input some values for both fields, if both password's don't match, we should see an error telling
us that they don't match.
Will receive an error from the validate, if we were to make the passwords match, then the error will
go away.
Great, we're finished with the name Email Age and Password Fields, we were able to cover some additional
rules.
A lot of the rules we covered can be reviewed by visiting the documentation.
We've still got a few more fields to validate.
Let's finish this up in the next couple of lectures.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.