Hello, friend, welcome back in this video and discussion about that form validation, like if you
want to define some of the form validation, if you want to display it, how can do that work?
In this video, I will show you that things with a live example for doing this right now here.
I don't need this.
I just simply remove it.
And now in our form, that means, you know, our APS application into the application I have created
on the file as a form Sprite.
So first of all, if you want to display that validation, you have to do we have to import some of
the library that in Django they have some of the building library as a validator, so you have to use
it.
So first of all, I wanted to put it on here, so I just simply defined the form and that then Django
OK, form Django the core and into the form, then got I to put it on the import of the library as a
validators.
OK, I just simply defined as the validators and now in particular that area that means in our class.
So here I want to do define some of the variable as a name and then with these forms, OK, with these
forms I want to define the type as a character.
Felt like I just simply defined the character characterful type and the characters will die with these
very letters.
OK, with these very letters, I just simply defined some of the very letters from the maximum length.
So I just simply defined as a with these validators, with this validators I want to define as one of
the type as a max length.
OK, invalidate, validate, OK, just to simplify the Max Lane validator, and here I define Marseillais
maximum length will be as a 10, so they step up one of the validation I want to define in particular
that area.
So now we have to do we have to visibly try.
So we have to it like in our pupate, that means in our form is will go to our farmers CMO.
So here I have defined that field.
So now in our view into the view here, I have defined this like that way.
Right.
So shall we display our D field and also I define our user form.
Perfect.
So now if you want to display it like I have already defined our district descend into the addition.
I have defined the text from right into the text one with this text from I have passed it in our form
e-mail.
So now with this I want to do and display some of the validation message I like after this.
OK, after this here I just simply define addiction.
So into addiction.
I want to update the message.
So the simple defense update and this update area, I just simply define without this text, OK, I
just simply defined that this text form.
So with this text form I want to display of whatever the message I get from our post and I just take
that things with this variable as a new our new form see in that area, I just simply defining it,
OK, then it will be displayed our all that Airaud, which is I have defined in our post area so that
those that are easily visible.
So I just simply defining it in particular that area.
So now if you click as Savol, I just came to save all and now I refresh it again.
So maybe they have seen the error.
Let's check this out, it's not showing as it has no attribute as a maximum validator.
So that is actually our spelling mistake.
Maybe again, from here you can see actually a spelling mistake there will be as a validator.
So just simply as a validator, Valaida, it you are OK, so that will be a letter here to save all.
Yeah, no, it's perfect, the spelling mistake friend, so now I just refresh it, yeah.
Now consider the input form.
So into this input form here, I have defined some of the length that with the maximum length will be
as a 10.
Right.
So now I want to do under defined sound that character.
Click on the submit.
Yes.
Now considering now showing some of that validation message as they Anshu, the value has at most in
character, but it has now the 20 character.
OK, so here if you define this one automatically, we calculated that data.
That means here I have defined some of the validation notes perfectly displayed.
And also here you can define some of the minimum length bellweather.
OK, so here I want to do want to define some of the minimum.
So here I define that maximum.
So now I want to do and define another one.
I just simply define another one with a validator.
So with the very letters here, we have to define our and other types or type as a minimum.
That means the minimum length validator.
OK, the simplifying of the minimum plan validator seem to the minimum that I define as a five right
now, Kleeger, to save all.
Check out our process.
Everything is perfect now I refresh it again, and now I define it.
A three click on the submit now consistent showing at the end should the value at last five character
I just put out of the three.
OK, so for the reasons you can see, there's also you getting these validation.
That means the minimum validation.
And also here, if you want to display multiple Airaud at a time, you can also defining it like here
right now I want to do I want to define another one.
I take another variable as a number.
OK, number under Schofield.
OK, just name it as a number field.
And for the number field, I define our form so our forms and then type will be at the integer field
type desert field.
So I just simply defined the entire field type and into the, into the field.
I have defined the same as a validator.
So with these very letters here, I have defined our ability to enter the validators.
I have maximum, so I just simply want the maximum.
So if you display your integer value, then you have to define as a value, not block, not the length.
OK, so for the reasons here, they have another type as a maximum value, very letter.
So just simply defending the value of a value validator.
So here I define as a ten.
OK, so here I define as the maximum value validator as a time.
And also if you want to display your minimum type, then you can also defining it.
So after this, after this, I simply define another one as a validator.
So with these validators, I want to define our and at the time as a minimum minimum value as a validator.
OK, and I hope you can understand about it.
So when you actually display some of the character field and you have to define that as a maximum validator
when you define as a Intisar field and you have to define that as a maximum value millilitre.
OK, so that is a maximum the letter and the minimum, the minimum I define as a five.
So now I just simply defined as a five in particular, that area.
Perfect.
So now I just click on to save all again.
And now in our former steel mill, in the former steel mill, I have defined that name Soheir as a field,
right.
So in particular view into the view, I have defined that as a battlefield.
So now I define our variables.
So here I define that variable name as it.
And this one has a number fields I just simply copied.
Now, here are defined as the number of field and also into this general I define as the number of field
now as to save all.
Now, refresh it again.
So now I define some of the validation on here and also I define the validation of the three to submit.
Yeah, you can see not perfectly getting our two of these validation suits perfectly, getting out this
maximum validation and also getting our maximum value validation perfect.
And I hope you can well understand about it.
So here you can do this work so that our form validation for the Intisar maximum value millilitre and
for the character, it will be at the maximum.
Glenvil.
Ed.
So far, the results here, you can see it's now perfectly visible on here and also here.
If you want to define this type of validation for the input, feel like I want to create one of the
input, feel that the email and also another one for the verification emails or whatever the things
you put in particular, that area is match with another input field.
OK, so here, if you want to display this type of validation, you can also do that work.
What I will show you that is our way that these are forms right now.
We will need this.
I just simply remove it.
So not only do I want to define another one, OK?
I want to define another one for this.
I want to do first of all, I want to take one of the variable for our input file.
I just name it as a user, underscore email and then we have to define our forms.
OK, I just simply defined the forms and with these forms I want to define our type or type will be
as email field type.
I just simply give an email field, OK, I just simplified the email field and also undertake another
one.
It should be a user verification email list of other reasons.
I simply defining the v mail, this step of one of the variables I want to take.
And with this form, like with this form, I also define that will be as the email type email field.
So to simplify the email file type, perfect.
And after that here I want to define one of the functions to simplify the DEVE and the clean clean.
And here I define as a self centered the self.
Here I want to do and define one of the variable as it all underscore clean, OK, clean data.
And into this position I want to use of the super functions.
If you use that super function, I just simplified super.
So with this super function you actually get all that your data, that means all the durability data
and take the things with this variable.
OK, so right now I just use that super and then our function as a clean, I just simply define as a
clean and then we have to define all that our variable as a user and then email into the C Daily Mail,
as I told you, with the super with the super function, I get all the raw data and take the things
with these variables.
And now with this variable, with this variable, I want to define our filename, our filename as a
user, underscore email that is our own field.
And also I have another one as a user, underscore email.
And then we are all clean data into this all clean data.
I want to use our end of the field as a user.
Underscore we women.
I just simply defining it, OK?
And now I want to do and reports on the condition here.
I define that you if condition if our user under called email when it shall be not match one or should
we not match with our user underscore female one it will be not match.
Then I want to write some of the validation so I just simply fundraise ok.
Just simply vandalise form.
So in the form that have also that means Django form library into the Django Form Library.
They have also done at that validation method.
That is actually the validation error.
I want to use it.
Validation error.
OK, to simplify the scenario and the validation error here, when it's really not match the source
of the message as a field, OK, fields don't match the step of one of the methods it will be displayed.
OK, so now we have to do we have to display it.
So here also make sure you adding that one.
So that is actually our condition if condition.
And here you have to define that colon and then our eyes form and the validation that the validation
error and the field on Matsuzawa display.
So should we take it when this will be not match, then it should be display or this validation matter?
That is a clear message.
And also here we have to define that things in our you know, our view and the view here.
I have defined that condition.
Voynich will be not Majdanek will be display our this message and when it be met.
OK, when it's a match then I want to pass it in our form area.
That means in our form e-mail at base area.
I want to pass it.
So here if you want to pass it, that means here I don't need this right now, I just simply remove
it.
And in particular that position I define the text.
So here it will be displayed.
The field fields match the step up.
One of the message is still the display.
Perfect.
So that's all you have to do.
So now let's check this out.
I just look at the Savol.
Let's clear the save all go here.
Refresh it again.
They have soldat or better to check it again first.
And here you can see snowshoeing is the rise form validation.
They have unexpected spaces.
OK, so that is very much common component of that.
Or if you go our form that means here after the try's here sound the add or actually is getting some
of the spaces that or so just simply defining it.
Savol.
Yeah, no, it's perfect, so no one to do it.
Check it, refresh, yeah, there is he email to I'd say just simply if an arion at the original dot
com and here I define that different.
Another one click on the submit.
Yes.
Now friend.
Now this email and our verification email is not match for the reasons it's not showing our desired
or as if we don't match.
So that is the condition I have defined on here.
Right?
When you shall be not matched with our verification email field, then it should be right.
Some of the form validation at all and it will be displayed.
This takes as a field or match field don't match.
So here is no showing of the field on match and also how I define another condition.
I define another condition in our, uh, you know, our view into the view when it will be match then
until we display our D field match.
Right.
This message shall be displayed in our dictionary.
I have already appetitive.
I have powers that things on here.
So now to do that, check this one.
So now I define Azarian.
That means now I define our appropriate email address and the password.
Click on the submit.
Yeah.
Now I can see they have no arrow is not showing that the field is because of all that is actually the
field.
So you know, our e-mail you can see are defined as ID no field.
So I just simply defined the field now clear to save all.
Refresh it again Ardian and then Ardian submit.
Yeah, perfect.
Now this is not so easy as a field match so I hope you can well understand about it.
So initially match the initial display, our field match.
So that is actually our field here.
I have defining it so here defining our field match.
So it will be in our display and we need to be as inappropriate.
Click on the submit then it will be for some of the validation as a field on.
I hope you can will understand about it, Fred.
So thanks for watching.
I will see you in the next video.