1 00:00:00,750 --> 00:00:09,180 I friends, friends in this video, we shall see the use of flask witf extension in a flask application. 2 00:00:15,500 --> 00:00:23,450 Now, the user interface in a Web based application is generally created with the help of her HTML form 3 00:00:23,450 --> 00:00:23,810 tag. 4 00:00:25,380 --> 00:00:33,450 A statement provides a form tag which is used to create a user interface in which are using which the 5 00:00:33,450 --> 00:00:37,590 user can enter the data input for that purpose. 6 00:00:37,860 --> 00:00:44,320 There are different form elements available, such like input, radio, select, etc.. 7 00:00:45,090 --> 00:00:50,160 That means if you want to create a text box in which the user should be user should be able to type 8 00:00:50,160 --> 00:00:57,870 certain data, what you do inside the form user input type is equal to text so that it will create a 9 00:00:57,870 --> 00:01:02,770 text books input table equal to radio, it will give you radio buttons and so on. 10 00:01:03,360 --> 00:01:07,140 So we are already aware of all these elements. 11 00:01:08,500 --> 00:01:17,050 Now, the data in there by the user using that form is submitted to the particular you are all that 12 00:01:17,050 --> 00:01:19,090 is given as a value of the attribute. 13 00:01:19,110 --> 00:01:20,400 Class action is equal. 14 00:01:21,420 --> 00:01:25,430 And generally, the method is used as the poster method. 15 00:01:27,290 --> 00:01:35,660 Now, the data that is entered is posted to the U r l. which is mentioned in action, is equal to attribute 16 00:01:36,860 --> 00:01:40,670 that is received by the server, the background server side script. 17 00:01:40,700 --> 00:01:48,110 In this case, the application has to recreate all the form elements that subscript the server side 18 00:01:48,110 --> 00:01:49,100 script has to. 19 00:01:50,480 --> 00:01:58,910 Access the data that is sent by the form and use it for for processing not therefore it is very difficult 20 00:01:58,910 --> 00:02:02,830 to render the form element because it is not a dynamic language. 21 00:02:03,110 --> 00:02:11,630 So therefore, rendering of the form elements dynamically is not possible in Stearman estimate itself 22 00:02:12,770 --> 00:02:15,230 being a static language. 23 00:02:16,310 --> 00:02:23,510 Does not have any validation facility, whichever or whatever the data user has input, it cannot be 24 00:02:23,510 --> 00:02:26,100 validated at most what you can do. 25 00:02:27,050 --> 00:02:33,640 You can run some deLaski functions over the e-mail data and then send it to the server. 26 00:02:34,190 --> 00:02:41,770 So such two major difficulties will be encountered when you create an user interface using this e-mail 27 00:02:41,780 --> 00:02:49,570 form that the formula cannot be rendered dynamically and there cannot be there is no validation facility. 28 00:02:49,940 --> 00:02:54,230 So to provide these two facilities, W-2 forms. 29 00:02:55,930 --> 00:02:57,070 Package can be used. 30 00:02:57,490 --> 00:03:03,940 It is a very flexible form rendering liability, and it also provides the validation support. 31 00:03:05,710 --> 00:03:16,820 So the beauty of is it is an extension which brings the WP forms facility or features into our flask 32 00:03:16,840 --> 00:03:17,400 application. 33 00:03:17,920 --> 00:03:24,810 So flask the extension, what is that and what how to use the flask WTS extension? 34 00:03:24,820 --> 00:03:27,430 That is the topic of this video. 35 00:03:31,420 --> 00:03:38,470 Using this flask, the beauty of extension, you can define the form for use in your Python script itself, 36 00:03:39,160 --> 00:03:41,570 if not, it doesn't have to be a stimulus. 37 00:03:41,800 --> 00:03:51,130 But within your Python script, you can define the form first and then you use that particular Python 38 00:03:51,130 --> 00:03:54,460 script to render an estimate template. 39 00:03:55,990 --> 00:04:04,360 It is also possible to apply the validation over this form in a WTO form fields with the help of the 40 00:04:04,360 --> 00:04:08,380 validation functionality that is available in WTO. 41 00:04:08,980 --> 00:04:12,820 So that is the advantage of this WTO fixation. 42 00:04:14,010 --> 00:04:24,480 So, Natalie, inside your flask environment, you have to install that extension by using the normal 43 00:04:24,690 --> 00:04:33,570 or regular people utility install flask, the beauty of that is all you can incorporate this extension 44 00:04:33,570 --> 00:04:35,190 into your flask environment. 45 00:04:36,150 --> 00:04:38,430 There are two major classes. 46 00:04:39,690 --> 00:04:43,200 Into this place, the beauty of extension, what is the form glass? 47 00:04:45,250 --> 00:04:51,040 That formula is to be used as the base or pattern for the user defined for. 48 00:04:52,160 --> 00:04:56,030 This is one secondly, the WP forms package. 49 00:04:57,620 --> 00:05:05,090 He's also a very important part of the resource of this extension, it contains the definitions of various 50 00:05:05,330 --> 00:05:08,690 farm fields which are equivalent to the. 51 00:05:10,070 --> 00:05:12,830 Form attributes or form elements in it. 52 00:05:13,280 --> 00:05:16,930 So what are what are the names of these foreign fields? 53 00:05:18,110 --> 00:05:26,270 There is that field farm, which is equivalent to input papers will text in our estimate boolean field 54 00:05:26,270 --> 00:05:34,070 is there where a certain form, certain field is likely to have only true or false values, which is 55 00:05:34,070 --> 00:05:34,960 equal to input. 56 00:05:34,980 --> 00:05:37,610 Time to check checkbox there. 57 00:05:38,330 --> 00:05:39,650 Boolean field is equal. 58 00:05:40,100 --> 00:05:47,690 Decimal field is the type of a text field where a number with decimal part can be entered into other 59 00:05:47,690 --> 00:05:48,080 fields. 60 00:05:48,080 --> 00:05:52,670 Another variation of text where only the integer can be displayed. 61 00:05:53,100 --> 00:05:59,480 Radio field represents input equal to radio in our Estherville form element. 62 00:06:00,140 --> 00:06:07,130 Select fields represent the select of the XML area is equal to the text area. 63 00:06:07,130 --> 00:06:10,470 Enlistment password is equal to input type equal. 64 00:06:10,490 --> 00:06:11,800 The password is very obvious. 65 00:06:12,740 --> 00:06:20,390 And lastly, submit field is a very most often used field which is equal to input type, equal to submit, 66 00:06:20,390 --> 00:06:27,210 because by pressing that data will be posted to the u r n, which is the target. 67 00:06:27,890 --> 00:06:34,220 So these are some of the important forward fields in this flask WTS extension. 68 00:06:38,030 --> 00:06:42,900 The summary of the court that you will use will help. 69 00:06:43,970 --> 00:06:45,020 This is the form. 70 00:06:46,430 --> 00:06:47,540 This is the form. 71 00:06:49,940 --> 00:06:58,040 You will import the form from the duty of exchange and this is the first step, and you will also import 72 00:06:58,250 --> 00:07:04,370 the different fields that you may be requiring in the design of the phone from their W2 forms. 73 00:07:04,910 --> 00:07:06,940 So these two are important. 74 00:07:07,010 --> 00:07:11,420 When that are necessary, then you design a form. 75 00:07:13,100 --> 00:07:19,330 The form class should be based upon the patent formulas. 76 00:07:19,790 --> 00:07:21,080 So the definition of. 77 00:07:22,330 --> 00:07:30,640 The form will be glass, the name of my family is a contact form, for example, based upon the farm, 78 00:07:30,820 --> 00:07:38,320 and then you define the different fields that you are intending to provide for the user to enter the 79 00:07:38,320 --> 00:07:38,580 data. 80 00:07:38,590 --> 00:07:40,420 For example, name is equal to TextField. 81 00:07:41,990 --> 00:07:47,290 Which is which will now be equal to what input type is equal to text in our estimate. 82 00:07:48,300 --> 00:07:57,420 So if you write such a contact form and then render this over the browser, then this will be equivalent 83 00:07:57,420 --> 00:07:58,230 to this. 84 00:07:58,260 --> 00:08:01,830 This is the equivalent Erskineville code that will be rendered. 85 00:08:03,320 --> 00:08:11,510 So any number of fields will be given in the definition of your farm, in this case the contact form, 86 00:08:11,660 --> 00:08:17,690 in addition to the fields that you have defined, there will be one additional field that will be automatically 87 00:08:17,690 --> 00:08:23,280 generated, which is a series of toker. 88 00:08:23,990 --> 00:08:25,430 What is this, CSIR? 89 00:08:25,670 --> 00:08:28,710 It stands for cross site request forgery. 90 00:08:29,600 --> 00:08:37,940 So in order to prevent this attack on your application, a hidden field is always inserted into the 91 00:08:38,390 --> 00:08:44,470 render the data rendered form, and therefore, in addition to the name of the student or input people 92 00:08:44,510 --> 00:08:53,530 to name input identical to text, which is the equal which is generated by this name is equal to textual. 93 00:08:53,660 --> 00:08:57,260 In addition to that, one more field will be rendered. 94 00:08:58,010 --> 00:09:02,410 Input identical to CSIR of token and type is equal to that. 95 00:09:02,510 --> 00:09:07,740 Importantly, because in that case the user will not be able to use it. 96 00:09:07,910 --> 00:09:09,350 That is how it can be. 97 00:09:09,950 --> 00:09:13,120 It is used to prevent this forgery attack. 98 00:09:15,140 --> 00:09:20,540 Some other fields can also be provided like, for example, radiophonic, if you want to use the this 99 00:09:20,540 --> 00:09:29,390 is the caption or label and the choices can be given in the form of tuples, the value, the key and 100 00:09:29,390 --> 00:09:35,770 the value the name and the value M stands for male F stands for women like that. 101 00:09:36,170 --> 00:09:40,490 You can also, for example, integer feel if you want to use integer fill h. 102 00:09:41,030 --> 00:09:45,830 Whatever data that will be input will be treated as an integer variable for each. 103 00:09:46,520 --> 00:09:49,820 So such a form design is one aspect. 104 00:09:53,260 --> 00:09:59,150 You can apply a validation to these forms of fees by using the validator class. 105 00:09:59,590 --> 00:10:07,420 The new reforms package has it validated, plus these different kinds of validations or validators are 106 00:10:07,420 --> 00:10:13,930 predefined in this W-2 forms package, for example, commonly used, validated validators. 107 00:10:13,930 --> 00:10:20,430 I have shown in this table that are required if you apply this validation over a particular field, 108 00:10:20,770 --> 00:10:27,580 then it will validate whether there is a data in it or not, whether the input field is empty or not. 109 00:10:29,080 --> 00:10:31,950 Email is another important validator. 110 00:10:31,960 --> 00:10:40,780 If you apply this, then it will check that the data are the Dextra table in a text box is conforming 111 00:10:40,780 --> 00:10:47,860 or is according to the email conventions, that should be ad and then there should be a domain name 112 00:10:47,860 --> 00:10:51,730 and dot, etc. etc. All those features will be verified. 113 00:10:52,300 --> 00:11:01,210 IP address is another validator checks whether the text to enter is equivalent to or is in the same 114 00:11:01,420 --> 00:11:03,500 order in which the IP address is written. 115 00:11:03,850 --> 00:11:10,550 Linked validator checks whether the length of the string in the input will is in the given region, 116 00:11:11,220 --> 00:11:21,070 given the range number range also is a validator where the the numeric text textfield the data in the 117 00:11:21,070 --> 00:11:28,360 numeric text file is in between the range that is provided as a number is another validator you are 118 00:11:28,360 --> 00:11:33,730 in which checks whether the that type of text is in the oral form or not. 119 00:11:34,150 --> 00:11:35,380 So these are the validators. 120 00:11:35,830 --> 00:11:37,480 We will use some of these. 121 00:11:39,020 --> 00:11:39,770 For example. 122 00:11:40,850 --> 00:11:47,590 TextField is the Farmville that I have used name is equal to TextField, this is, of course the caption 123 00:11:47,600 --> 00:11:52,310 name of the squirrel validator applied, invalided are required. 124 00:11:53,370 --> 00:11:56,620 So which means that there should be a data into the field. 125 00:11:56,930 --> 00:11:59,090 If not, then it will raise an error. 126 00:12:00,890 --> 00:12:05,140 Another example I can show email is equal to Texasville email. 127 00:12:05,270 --> 00:12:08,700 In order to write email, I am providing a text file. 128 00:12:08,960 --> 00:12:12,040 This is the caption to validate. 129 00:12:12,050 --> 00:12:19,250 Those are applied when evaluators require, which means that there there must be certain that are typed 130 00:12:19,250 --> 00:12:19,550 in it. 131 00:12:19,850 --> 00:12:27,530 And secondly, it does not email which will verify whether the text or typewritten is according to the 132 00:12:27,530 --> 00:12:28,810 email preconvention. 133 00:12:29,060 --> 00:12:31,170 If not, it will raise the error. 134 00:12:31,700 --> 00:12:37,490 Now, when these errors are raised by the validate function, then what will happen? 135 00:12:37,700 --> 00:12:44,060 These error messages will be rendered to the template in the estimate template. 136 00:12:44,180 --> 00:12:53,660 All these error messages are rendered dynamically by this format for messaging, for not named or errors, 137 00:12:53,660 --> 00:12:58,850 for example, namely the field on which there might be some errors. 138 00:12:59,120 --> 00:13:06,740 So those errors will be dynamically rendered by using the Ginge to templating syntax. 139 00:13:07,220 --> 00:13:19,910 So such like all these facilities are provided in the flask WITF extension to create a form to render 140 00:13:19,910 --> 00:13:27,980 the form as a template, then apply the validation and if the validation through certain errors, those 141 00:13:27,980 --> 00:13:31,060 errors will be flashed on the template itself. 142 00:13:31,250 --> 00:13:38,540 So all these mechanism I will show with the help of an example where a form will be their user enters 143 00:13:38,540 --> 00:13:41,840 the data and if there is any error, errors will be displayed. 144 00:13:41,840 --> 00:13:45,740 Otherwise a success message will be displayed on the browser. 145 00:13:45,830 --> 00:13:48,680 So let us see an example of all these activities. 146 00:13:49,670 --> 00:13:56,740 So I will now show you the use of W-2 forms, extension in a flask. 147 00:13:57,440 --> 00:14:00,620 Lask application to the name of the extension is Flask. 148 00:14:00,620 --> 00:14:08,390 Underscore the beauty of the first and foremost we are to ensure that this flask, the extension is 149 00:14:08,390 --> 00:14:13,610 already installed in our flask involvement or not. 150 00:14:14,510 --> 00:14:19,790 So the usual way of installing a particular module is by using the. 151 00:14:22,980 --> 00:14:27,510 So this is the virtual environment in which we are working. 152 00:14:28,800 --> 00:14:33,810 And using the pivotally, I will try to install the flask, the beautiful extension. 153 00:14:37,130 --> 00:14:38,630 It says that this is already. 154 00:14:39,860 --> 00:14:41,760 Present are installed in this environment. 155 00:14:41,780 --> 00:14:47,990 If it were if it was not present, then it would have installed the flask WTS extension. 156 00:14:48,650 --> 00:14:50,780 We can also verify whether. 157 00:14:51,870 --> 00:14:55,390 This flask, WCF extension is present or not? 158 00:14:55,890 --> 00:14:57,060 What I will do, I will. 159 00:15:00,210 --> 00:15:02,670 Start the interpreter and try to. 160 00:15:04,390 --> 00:15:05,200 Import. 161 00:15:09,580 --> 00:15:12,560 Last, if if it accepts, then fine. 162 00:15:13,390 --> 00:15:19,040 Otherwise, it will it will mean that the extension is not OK. 163 00:15:20,900 --> 00:15:22,040 So come out of this. 164 00:15:26,220 --> 00:15:34,530 Now, what are the components or what are the different called the snippets that are needed for the 165 00:15:34,530 --> 00:15:35,580 rendering of the form? 166 00:15:40,500 --> 00:15:48,840 So first you have to design the foam, this flask, underscore the beauty to the F module, contains 167 00:15:48,840 --> 00:15:50,160 a glass or less form. 168 00:15:51,350 --> 00:15:58,980 This farm is to be used as a base class for your user, user defined form class. 169 00:15:59,000 --> 00:16:00,750 I'm calling it as contact form. 170 00:16:00,770 --> 00:16:10,790 So this so my contact form is based upon these form class, which I am importing from the plus if it 171 00:16:10,790 --> 00:16:11,480 also has. 172 00:16:12,500 --> 00:16:17,240 A Marine Corps LSW deforms in which all the farm elements. 173 00:16:18,340 --> 00:16:25,450 Like TextField, integer, full text area, etc, etc., all are present, so we have to import all 174 00:16:25,450 --> 00:16:28,360 those that are needed to design this particular form. 175 00:16:28,840 --> 00:16:36,910 So in my form, a textfield integer full text area will submit full, which is equal to the submit button 176 00:16:36,910 --> 00:16:39,220 in the text in the HTML. 177 00:16:39,490 --> 00:16:40,330 Really awful. 178 00:16:40,660 --> 00:16:44,490 And the select will these many types of files I am going to use. 179 00:16:44,680 --> 00:16:45,790 So I imported. 180 00:16:47,330 --> 00:16:50,690 And I also want to apply certain validators. 181 00:16:51,670 --> 00:17:00,900 To the subtext, feel some some, uh, you know, feels so I am also importing the validators and the 182 00:17:00,940 --> 00:17:02,010 validation error. 183 00:17:05,300 --> 00:17:10,700 So in the contact form class, the objects that are. 184 00:17:12,460 --> 00:17:19,870 Declare his name is equal to TextField, this is the label of the text will name of the student and 185 00:17:19,870 --> 00:17:27,310 the validation applied to this name feelies validation required if it needed the validation fails, 186 00:17:27,310 --> 00:17:31,420 then the error message that should be displayed is, please enter your name. 187 00:17:32,960 --> 00:17:35,780 Then another object is a radio field. 188 00:17:37,300 --> 00:17:39,470 Object, I'm calling it a gender. 189 00:17:40,330 --> 00:17:42,280 This is the label and. 190 00:17:43,900 --> 00:17:48,850 The exclusive choices to be made are male and female. 191 00:17:50,360 --> 00:17:57,170 So they are presented in the form of a list object in which to Stupples the. 192 00:17:59,040 --> 00:18:06,720 The name of the variable and associated ception name and the caption that provided so this is the. 193 00:18:09,080 --> 00:18:12,380 Gender field address is a text area, Phil. 194 00:18:14,970 --> 00:18:16,860 Then I have to. 195 00:18:17,870 --> 00:18:23,930 Again, provide a Texasville for e-mail, so e-mail is equal to TextField, this is the label and the 196 00:18:23,930 --> 00:18:26,210 validation that I want to apply. 197 00:18:26,750 --> 00:18:28,340 There are two types of validation. 198 00:18:28,370 --> 00:18:31,880 One is that the value that is required will be verified. 199 00:18:32,090 --> 00:18:35,050 If it is not at all, enter then the error message. 200 00:18:35,390 --> 00:18:37,020 Please enter your email already. 201 00:18:37,520 --> 00:18:40,400 And there is another validator I want to apply to. 202 00:18:40,400 --> 00:18:42,440 This text will validate us, not email. 203 00:18:42,450 --> 00:18:43,790 It will ensure that the. 204 00:18:45,580 --> 00:18:51,100 Entry in this field is, according to our expert, the requirements of an email address. 205 00:18:52,090 --> 00:18:58,990 Then there is an integer field goal, as is selection field or select field, which will give your dropdown. 206 00:19:01,130 --> 00:19:04,310 And the user can make choices out of. 207 00:19:05,940 --> 00:19:14,490 These two entries, uh, C++ and Python, so these are the actual text that will appear and these are 208 00:19:14,490 --> 00:19:18,560 the two, uh, you know, names that are associated with each of them. 209 00:19:18,570 --> 00:19:23,160 And then there is a submit field, which is equal to the submit button. 210 00:19:24,500 --> 00:19:27,260 So this is how you had to design the form for us? 211 00:19:27,300 --> 00:19:31,660 I am I am calling it a contact form in my execution. 212 00:19:32,890 --> 00:19:35,810 Good, I have to import this contact form also. 213 00:19:36,160 --> 00:19:40,510 So let us have a look at the execution side of our Python script. 214 00:19:44,400 --> 00:19:45,780 So this is the application called. 215 00:19:47,310 --> 00:19:54,630 Here, the flask application object is declared before which all the necessary. 216 00:19:55,690 --> 00:20:03,560 Resources from the flask application are important, as well as the contact form that we have designed. 217 00:20:03,790 --> 00:20:05,950 That is also important. 218 00:20:08,150 --> 00:20:11,980 Ensure that there is a secret key in place. 219 00:20:13,710 --> 00:20:22,650 Now, one new old rule is defined in this so-called contact accepts the matters get or post. 220 00:20:24,620 --> 00:20:32,690 What is the associated view, function, contact and in which, first and foremost, create the object 221 00:20:32,690 --> 00:20:34,640 of our contact form plus. 222 00:20:36,600 --> 00:20:36,980 Right. 223 00:20:38,010 --> 00:20:40,710 Now inside this contact function. 224 00:20:42,570 --> 00:20:46,130 Verify whether the request method is used or not. 225 00:20:47,210 --> 00:20:56,240 So obviously, when the user enters the localhost 5000 contact in the atmosphere of the browser, the 226 00:20:56,240 --> 00:20:58,390 method will not be able to post, it will be get. 227 00:20:59,060 --> 00:21:03,140 So that means this will be, you know, encountered. 228 00:21:07,910 --> 00:21:12,740 Right, because it is the first time the user has directly entered this, you are also it will not be 229 00:21:12,740 --> 00:21:14,280 a personal matter, but it is admitted. 230 00:21:14,690 --> 00:21:22,640 So in case it is a matter, then what what it has to do, the browser will be redirected towards or 231 00:21:22,730 --> 00:21:24,950 rather a template will be rendered. 232 00:21:26,280 --> 00:21:32,940 All of the name contact that e-mail, which takes one attribute or one argument, which is the form 233 00:21:32,940 --> 00:21:35,070 is equal to our form object. 234 00:21:37,480 --> 00:21:43,990 So it will go into the contact, that estimate will have a look at this counterprotest even a little. 235 00:21:45,800 --> 00:21:48,140 If, on the other hand, the is boost. 236 00:21:49,070 --> 00:21:56,210 But the validation of the form which form the contact form that we have designed, if the validation 237 00:21:56,210 --> 00:21:59,600 fails, then a message will be flashed. 238 00:21:59,870 --> 00:22:07,640 All fields are required where this flash will appear, it will appear in the next review function when 239 00:22:07,640 --> 00:22:13,160 they render the template contact rotation will be rendered on the top of it. 240 00:22:13,430 --> 00:22:20,640 This flashmob stage will be displayed along with any error messages that the form might have generated. 241 00:22:21,590 --> 00:22:22,610 So in either way. 242 00:22:24,230 --> 00:22:27,470 If the matter is forced, but there are errors. 243 00:22:28,930 --> 00:22:31,630 The contact estimate will reappear. 244 00:22:33,690 --> 00:22:40,650 Or if the method is not post, the contact, not estimate will be appear appearing if the validation 245 00:22:40,650 --> 00:22:46,680 is successful, if the post method is there, validation is successful, then the success that estimate 246 00:22:46,680 --> 00:22:47,310 will be rendered. 247 00:22:47,310 --> 00:22:50,970 It will just display a success message. 248 00:22:52,070 --> 00:22:55,800 OK, so this is the execution part of our Python script. 249 00:22:56,180 --> 00:22:56,960 So what remains? 250 00:22:58,050 --> 00:23:00,620 I will look at the contact that estimate. 251 00:23:04,160 --> 00:23:10,310 So this is the contact or the e-mail, which is basically the rendering, the form. 252 00:23:12,630 --> 00:23:13,770 That we have designed. 253 00:23:20,240 --> 00:23:20,780 So. 254 00:23:21,790 --> 00:23:25,930 In this form, all the form elements that we have designed. 255 00:23:26,970 --> 00:23:28,950 Using our W-2 forms. 256 00:23:30,540 --> 00:23:31,620 You know, package. 257 00:23:33,240 --> 00:23:36,870 Those elements are rendered here, for example. 258 00:23:39,260 --> 00:23:40,220 We have seen that. 259 00:23:41,730 --> 00:23:42,780 Any of these? 260 00:23:43,800 --> 00:23:51,210 Form elements that are used from the W.T. forms in addition to whatever, you know, elements or form 261 00:23:51,450 --> 00:23:54,150 fields that you design one additional. 262 00:23:55,290 --> 00:23:57,630 Element is created, which is a hidden tag. 263 00:23:58,900 --> 00:24:06,940 And in addition to that, we are we are defined in name, form, field, it has two attributes, label 264 00:24:06,940 --> 00:24:07,600 and name. 265 00:24:08,410 --> 00:24:10,360 Gender has a label. 266 00:24:11,210 --> 00:24:11,640 And. 267 00:24:13,740 --> 00:24:22,410 Gender as a field address has a label address, a diffuse e-mail has a label and field is language, 268 00:24:22,410 --> 00:24:24,830 etc. and lastly, the form segment. 269 00:24:25,200 --> 00:24:28,950 So all we are doing is dynamically rendering. 270 00:24:30,350 --> 00:24:32,000 The form elements. 271 00:24:33,390 --> 00:24:41,730 A different form will that we have defined in our contact form into this browser web page by using the 272 00:24:41,910 --> 00:24:43,230 ginger to template. 273 00:24:44,370 --> 00:24:49,530 You know, mechanism, you can see that all these formed odd name. 274 00:24:50,470 --> 00:24:51,700 Paumgarten name is. 275 00:24:54,120 --> 00:24:55,230 You know, the name of the. 276 00:24:56,280 --> 00:25:02,040 Name infield, which we are defined in the contact form, so that is dynamically rendered by using this 277 00:25:02,430 --> 00:25:06,990 double curlee record in order to escape out of the. 278 00:25:09,050 --> 00:25:15,500 So this is how the farm is rendered dynamically on the browser before which. 279 00:25:16,980 --> 00:25:23,100 Before which if the farm has already been posted and if it encounters any error or messages, those 280 00:25:23,100 --> 00:25:25,590 are, you know, flashed. 281 00:25:26,590 --> 00:25:33,790 On to the browser, for instance, if there are any messages like there was one message, all the files 282 00:25:33,790 --> 00:25:34,510 are necessary. 283 00:25:34,840 --> 00:25:40,720 That message will be displayed on the browser with the help of. 284 00:25:42,150 --> 00:25:46,380 Get flashing messages and taking one message at a time. 285 00:25:47,310 --> 00:25:49,130 In our case, there will be only one message. 286 00:25:49,560 --> 00:25:50,900 So that will be displayed here. 287 00:25:51,360 --> 00:25:58,140 If while encountering the validation of the name feel, if it encounters an error, then that message 288 00:25:58,140 --> 00:25:59,030 will be displayed here. 289 00:25:59,430 --> 00:26:05,420 If while and while validating the email feel if it encounters error, that will be displayed here. 290 00:26:06,700 --> 00:26:13,030 So if the farm is happening for the first time, the entire farm will be displayed, if it is appearing 291 00:26:13,030 --> 00:26:17,950 subsequently, then if there are any errors or messages, those will be fleshed. 292 00:26:19,170 --> 00:26:28,350 Now, this is our contact, not even so, we have seen the form plus the contact form, the application 293 00:26:28,350 --> 00:26:31,860 side of the form example in which. 294 00:26:33,630 --> 00:26:34,350 All the. 295 00:26:35,600 --> 00:26:40,640 You are jealous and associated, you functions are defined, and this is the correct form of contact, 296 00:26:40,640 --> 00:26:44,480 not esteem, in addition to that, there is a there will be a success. 297 00:26:44,480 --> 00:26:45,620 The artist will also. 298 00:26:50,660 --> 00:26:58,370 Which will just print out the message from postered successfully if there are no errors found in the 299 00:26:58,970 --> 00:27:01,920 farm after the farm is posted. 300 00:27:02,420 --> 00:27:05,300 So this is all the code that we have now. 301 00:27:05,320 --> 00:27:06,830 We will do the. 302 00:27:09,310 --> 00:27:15,880 All the activities, one by one, to show that this is out of the WTO forms are used. 303 00:27:18,580 --> 00:27:25,750 So let us come to the command prompt and execute our Python script named as Flaum. 304 00:27:28,180 --> 00:27:29,290 Example. 305 00:27:31,110 --> 00:27:32,100 NCUA. 306 00:27:33,340 --> 00:27:34,930 It start the server. 307 00:27:41,130 --> 00:27:49,110 OK, so now we shall go to the browser and give the URL as localhost 5000 slash contact. 308 00:27:51,580 --> 00:27:52,750 So in the browser. 309 00:28:00,930 --> 00:28:01,740 Backslash. 310 00:28:02,970 --> 00:28:03,660 Contact. 311 00:28:07,650 --> 00:28:09,570 So the contact form is displayed. 312 00:28:11,940 --> 00:28:18,180 OK, so different possibilities we shall generate and see what are the error messages. 313 00:28:20,380 --> 00:28:21,730 For example, I will. 314 00:28:22,770 --> 00:28:24,600 Leave this name on the screen blank. 315 00:28:27,170 --> 00:28:28,720 Will the rest of the elements? 316 00:28:42,160 --> 00:28:42,730 And. 317 00:28:44,340 --> 00:28:45,360 Make the selection. 318 00:28:48,750 --> 00:28:50,850 You see all the fields that require. 319 00:28:52,770 --> 00:28:54,960 Secondly, I will enter some. 320 00:28:55,910 --> 00:28:56,750 Element here. 321 00:29:00,780 --> 00:29:01,500 But I will. 322 00:29:03,660 --> 00:29:08,190 Purposefully enter the e-mail in some. 323 00:29:10,510 --> 00:29:11,500 Environmental. 324 00:29:17,570 --> 00:29:21,410 It will say, please enter your email address, which is not proper. 325 00:29:23,080 --> 00:29:31,420 If, on the other hand, if all the elements are all the entries in the form are probably mention. 326 00:29:33,080 --> 00:29:33,980 Then, of course. 327 00:29:40,920 --> 00:29:42,420 The form will be validated. 328 00:29:44,040 --> 00:29:48,060 And the message from postered successfully will appear so that how. 329 00:29:49,030 --> 00:29:52,090 A user friendly. 330 00:29:53,410 --> 00:30:00,760 Form can be designed by using the flask WITF extension in a flask application.