Python Flask WT-Forms Demo: Number-Range Validator

preview_player
Показать описание
In this video we add a Number-Range validator to the WTF IntegerField and DecimalField. When establishing a field (which turns into a user input element on the HTML form), the validators argument consists of a list. In our earlier example, we had the number inputs had an InputRequired() validator. Here we add a Number-Range validator that specifies in our example that the user's hours entry should be between 0 and 85 hours This produced a min="3" attribute and a max="85" attribute in the wage number input. Similarly, we insist that the wage entry should be between 7.25 and 200. We added our own messages to be displayed on error, but these were superseded by the browser's handling of the error.
Рекомендации по теме
welcome to shbcf.ru