[python foundation] Flasky-form WTForms supported html fields and built-in functions

The HTML standard fields supported by WTForms are shown in Table 4-1. Table 4-1 HTML standard field types
supported by WTForms Description StringField Text field TextAreaField Multi-line text field PasswordField Password text field HiddenField Hidden text field DateField Text field, the value is datetime.date format DateTimeField text field, the value is datetime.datetime format IntegerField Text field, the value is an integer DecimalField Text field, the value is decimal.Decimal FloatField Text field, the value is a float BooleanField Check box, the value is True and False RadioField A set of radio boxes SelectField drop-down list SelectMultipleField drop-down list, you can select multiple Value FileField File upload field SubmitField Form submit button FormField Embeds the form as a field in another form FieldList A set of fields of a specified type



















The built-in validation functions of WTForms are shown in Table 4-2.
Table 4-2 WTForms Validation Functions
Validation Function Description
Email Validate the email address
EqualTo Compare the values ​​of two fields; often used when the password is required to be entered twice for confirmation
IPAddress Validate the IPv4 network address
Length Validate the length of the input string
NumberRange Validate the input Value is in the range of numbers
Optional Skip other validation functions when no input value
Required Ensure data in field
Regexp Validate input value using regular expression
URL Validate URL
AnyOf Ensure input value is in optional list
NoneOf Ensure input value is not optional List

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326434335&siteId=291194637