Relative Content

Tag Archive for pythonflaskflask-wtforms

Flask-WTF: How to define costum variables in Flask FormField

I am trying to setup a dynamic form in Flask where the form has a dynamically populated FieldList of FormFields. While most of it works, I keep running into issues with the variables of each FormField. I need each FormField to have a label which is the name of the FormField (and is rendered on page) and a costum ID which is used in a show/hide script which uses a dynamically filled SelectField to select a sub-form to show and hide. However, I cannot get the variables to retain their state after the form is submitted, which also prevents me from correctly processing the returned data.