Validating required fields

What this means is that you are telling the formset how many additional forms to show in addition to the number of forms it generates from the initial data.

Let’s take a look at an example: There are now a total of three forms showing above.

Therefore, you also have to make sure that the values that users enter can be correctly converted to the appropriate data types.

In that case, the validation is performed as users work in the browser.For example, suppose you specify that a value should be an integer.On the other hand, if you are using Java Script to allow deletion of existing objects, then you need to ensure the ones being removed are properly marked for deletion by including returns the number of forms in the formset that were pre-filled, and is also used to determine how many forms are required.You will probably never need to override either of these methods, so please be sure you understand what they do before doing so.When you restrict the values that users can enter in forms, you reduce the chance that someone can enter a value that can compromise the security of your site.

To see how validation works, run this page and deliberately make mistakes.

Performing validation in server code is a security measure, in case users bypass client-based validation.

In this example, the test for a valid date won't work in client code.

If a user enters a non-integer value, the error is reported as soon as the user leaves the entry field.

Users get immediate feedback, which is convenient for them.

When users enter values into an HTML form, the values that they enter are strings.