Python Flask WTForms Demo: Length Validator

Pubblicato il: 18 luglio 2023
sul canale di: Thomas Blum
472
8

In this video we add a length validator to a WTF StringField. The validators argument is a list of validation tests. Previously, we had an InputRequired() validator and to this we added a Length validator that specified in our example that the user's entry should be between 3 and 20 characters. This produced a minlength="3" attribute and a maxlength="20" attribute in the text input. We added our own messages to be displayed on error, but these were superseded by the browser's handling of the error. Within the Python handling the routing we switched from form.is_submitted() to form.validate_on_submit(), though this seemed not to make much difference here.


In questa pagina del sito puoi guardare il video online Python Flask WTForms Demo: Length Validator della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Thomas Blum 18 luglio 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 472 volte e gli è piaciuto 8 spettatori. Buona visione!