wtforms Questions

4

I've been able to implement this change to create Field which is disabled in WTForms. How would I selectively disable a field in my view before rendering it?
Trebuchet asked 7/5, 2013 at 16:45

4

I want to add "data-" attributes to a form field for integration with Bootstrap. I tried the following in a template: {{ form.test(data-toggle="toggle", data-size="mini", data-on="Yes", data-off="...
Ubiety asked 5/1, 2015 at 11:56

2

Solved

I have flask+wtforms application. I can see in login() user object stored as if user: if user.verify_password(form.password.data): flash('You have been logged in') user.logins += 1 db.sess...
Jacquline asked 23/3, 2013 at 20:19

2

Solved

I did a small Flask app with a form with two date fields, and this is how I populate the values: class BoringForm(Form): until = DateTimeField("Until", format="%Y-%m-%dT%H:%M:%S", default=date...
Paleface asked 11/12, 2014 at 10:55

2

Solved

I'm building a website using Flask in which I use WTForms. In a Form I now want to use a FieldList of FormFields as follows: class LocationForm(Form): location_id = StringField('location_id') ci...
Forth asked 8/5, 2015 at 10:38

4

I am trying to create a SelectField or SelectMultipleField that allows me to add attributes to it's <option> tags. I am trying to add attributes like data-id or another data-____. I have not ...
Hedges asked 4/5, 2014 at 19:50

3

Solved

I understand the SelectField method in WTForms takes can argument choices which has the form... choices=[("value1", "display of value 1"), ("value2", "display of value 2")] I need to populate my...
Antiquate asked 8/12, 2012 at 20:28

2

Solved

I have a flask app that uses wtforms. I have a file which does: from wtforms.fields.html5 import DateField, EmailField, TelField # rest of the file I just wanted to rebuild my docker container an...
Etiquette asked 22/11, 2021 at 15:37

1

Solved

While we are trying to execute with python 3.6.8 version getting below module error from wtforms.compat import string_types, text_type ModuleNotFoundError: No module named 'wtforms.compat' when i ...
Scabble asked 8/11, 2021 at 6:9

1

I am trying to use csrf protection on my website with no luck. I am doing everything the documentation says but it still says I am missing the csrf session token. And when I try printing the ...
Pelecypod asked 2/10, 2021 at 10:0

2

Solved

I have a Flask-WTF form with with DataRequired validators and related error messages. However, the Chrome browser seems to ignore my error messages and just displays "Please fill out this field". H...
Woosley asked 10/6, 2018 at 20:47

4

Solved

I have three identical SelectField inputs in a form, each with the same set of options. I can't use one multiple select. I want to make sure that the user selects three different choices for these...
Morehead asked 16/2, 2014 at 17:52

3

Solved

Here is my code: class CreateUser(Form): username = StringField('Username', [ validators.Regexp('\w+', message="Username must contain only letters numbers or underscore"), validators.Length(min...
Briefing asked 27/8, 2014 at 17:22

4

I'm generating a html form with wtforms like this: <div class="control-group"> {% for subfield in form.time_offset %} <label class="radio"> {{ subfield }} {{ subfield.label }} &lt...
Shrike asked 22/5, 2013 at 14:14

3

I have a wtforms form class MyForm(Form): names = SelectField('name', choices=[]) The choices of names field is built dynamically and rendered in the template by an ajax call. When I submit th...
Heartsome asked 21/1, 2013 at 6:0

3

Solved

I would like to pre-select the value for SelectField when displaying it to user. default argument works when it is passed at the time of instantiation but does not work once the field is initialize...
Kurt asked 22/3, 2016 at 14:37

4

Solved

I am using WTForms in conjunction with Flask and I would like to integrate the Bootstrap Form Validation for errors in my form. I have a basic login form setup something like this: class LoginForm...
Laxation asked 16/4, 2020 at 1:17

2

Solved

What seemed like a simple bug - a form submission that won't go through due to a "CSRF token missing" error - has turned into a day of hair pulling. I have gone through every SO article related to ...
Herewith asked 31/8, 2016 at 22:52

3

Solved

I'm using Flask with WTForms (doc) on Google App Engine. What is the best way to generate an field with an empty value for a select field? form.group_id.choices = [(g.key().id(), g.name) for g in ...
Dort asked 3/5, 2011 at 11:24

4

I'm trying out Flask but I'm having the error sqlalchemy.exc.InterfaceError: <unprintable InterfaceError object> while submitting a wtforms. The model class is: class Post(db.Model): __tabl...
Brambling asked 27/4, 2015 at 6:30

3

Solved

How I would dynamically create a few form fields with different questions, but the same answers? from wtforms import Form, RadioField from wtforms.validators import Required class VariableForm(Fo...
Septennial asked 24/7, 2012 at 0:41

2

Solved

I have a Flask application that uses WTForms for user input. It uses a SelectMultipleField in a form. I can't seem to get the app to POST all items in the field when selected; it only sends the fir...
Bharat asked 26/11, 2012 at 3:35

4

Solved

I'm using jinja to render a flask-wtf submit button as follows: {{ wtf.form_field(form.submit) }} This results in a button formatted in btn-default bootstrap format (white). I'd like to change t...
Snips asked 25/5, 2015 at 12:12

1

I'm creating a small corporate web-portal. There will be computers database which contains information about all the computers in a company. I'm creating a WTForm for editing computers' properties....
Westminster asked 2/8, 2019 at 14:40

3

Solved

I would like to add a cancel button which goes back to previous page. My code is : forms.py: from flask_wtf import Form from wtforms import StringField, HiddenField, SubmitField from wtforms.valida...
Belorussia asked 16/8, 2020 at 7:31

© 2022 - 2024 — McMap. All rights reserved.