wtforms Questions
1
Solved
I've been biting my nails on this one for quite some time. In my Flask-app I currently have a product-database, for which in the app I have a page that queries each product column into a table.
F...
4
Solved
I am rather new to WTForms, Flask-WTF. I can't figure out how to simply add the HTML5 attribute "autofocus" to one of the form field, from the form definition. I would like to do that in the Python...
Phantasy asked 12/8, 2015 at 15:8
2
Solved
Calling a WTForms field object produces the rendered field, and any arguments are taken as attributes, for instance.
form.field(attribute='value')
would return something like
<input attribut...
5
Solved
This is a question upon the use of wtforms SelectField.
Once the form submitted, I wish to extract selected text.
I have the following form:
from wtforms import Form, SelectField
class TestForm...
0
I'm getting this error only when the field is defined in a form that contains other fields- but when its defined in a it's own form, this error is not generated and it works.
Firstly I will show ...
Combatant asked 24/8, 2017 at 16:23
1
Solved
Most of the info I find online is for multiple checkboxes. I just want 1.
I have:
class CategoryForm(FlaskForm):
category = StringField('category',validators=[DataRequired()])
checkbox = Bool...
Szombathely asked 10/8, 2017 at 0:28
1
i have a form that uses a widget. what i want is two vertical columns side by side with the checkboxes.
class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=Fal...
Phio asked 18/7, 2017 at 23:42
1
I am having troubles with form validation. The country list is generated correctly, and previous forms worked fine. It is only breaking in POST requests.
Here is my forms.py:
from wtforms import ...
1
Solved
I want to define a form class with fields based on a dict of name: label. I tried the following, which nearly worked. However, rendering the fields in a template gave AttributeError: 'UnboundField'...
Knute asked 9/5, 2017 at 2:16
2
OK. I know this has been tackled many times but I can't find an answer with a useful example of javascript to use.
Say I have this form:
class MyForm(Form):
category = SelectField("Category")
i...
Appointed asked 5/1, 2016 at 18:39
4
Solved
First, I'm new to python and Flask, so I'm sorry if my question is dumb. I search it but never found an answer (which should be an "easy" one I guess).
I wanted to add a contact page in my website...
Thill asked 3/1, 2014 at 13:52
1
Solved
I have a WTF SelectField, and I'm trying to store the name of the user's choice for display on another page.
Given that my form is
choice = SelectField('Choice', choices=[('cho_1', 'Choice ...
2
Solved
I need to generate my fields in the constructor of the form since the number of fields needed can vary. I think my current solution is the problem. I get an exception when I try to expand the form ...
3
Solved
I have a template which allows the user to edit their user information.
<form method="post">
<table>
<tr>
<td>Username:</td>
<td>{{user['username']}}</td...
3
Solved
I've got my Pylint install importing flask just fine. And with that same installation of flask, I have wtforms running just fine in my application. However, when I run Pylint on a file importing wt...
2
Solved
How do I get the data from a WTForms form after submitting it? I want to get the email entered in the form.
class ApplicationForm(Form):
email = StringField()
@app.route('/', methods=['GET', 'PO...
2
Solved
I am using Flask to develop a web application. I was originally doing HTML forms manually, and then switched over to using WTForms (this is an educational project, so I am showing each step of buil...
Grotesquery asked 10/1, 2016 at 13:30
1
Solved
I want to create different forms in Flask using WTForms and Jinja2. I make a call to mysql, which has the type of field.
So i.e. the table could be:
form_id | type | key | options | default_val...
1
Solved
I have experience with PHP but im new to Flask and Python and I need help with a simple thing.
I have a database table and I need each entry in a radio button. I need to use WTForms but I can't do...
Expertism asked 8/7, 2016 at 2:17
2
I have an empty select field that has choices that I define during run time:
myfield = SelectField('myfield', validators=[Optional()])
I'm trying to have this work with a GET request which looks...
Landholder asked 17/2, 2016 at 15:3
1
Solved
The following flask code creates a select .. option dropdown menu:
model:
class SelectForm(Form):
country = SelectField('Country', choices=[
('us','USA'),('gb','Great Britain'),('ru','Russia')]...
Extrusive asked 23/6, 2016 at 23:59
2
Solved
I have a select field that has certain elements faded and disabled that I would like to render with WTForms:
<select name="cg" id="cat" class="search_category">
<option value='' >{% tr...
Delate asked 11/12, 2011 at 10:58
2
Solved
I wrote an SQL query which uses data passed in from WTForms as parameters.
How do I ensure double quotes on the variable?
q = """
select * from table
where dt_date >= %(date)s""" % {'date':dat...
3
Solved
Simple form:
class AdjustPWMForm(Form):
dutyCycle = IntegerField('dutycycle')
#dutyCycle = IntegerField('dutycycle', default=44)
View function:
def adjust():
user = g.user
form = AdjustPWM...
Tafoya asked 13/10, 2014 at 15:12
4
Solved
is there a way i could send a form's (css) class from python?
For example:
class Company(Form):
companyName = TextField('Company Name', [validators.Length(min=3, max = 60)])
This renders a simp...
© 2022 - 2024 — McMap. All rights reserved.