wtforms Questions
1
Solved
I have a HTML form inside a landing page and I want to send the forms data by ajax to /data rout.
The problem is validating this HTML form in backend.
I know about Flask WTF form but using this met...
Boutis asked 20/4, 2019 at 9:12
3
Solved
After form is submitted with a POST request, every Field data has its value, except DateTimeLocalField. Accessing DateTimeLocalField's data value is a type of None.
Form
class ArticleForm(FlaskForm...
2
Solved
I have a Flask app in which I can populate form data by uploading a CSV file which is then read. I want to populate a FieldList with the data read from the CSV. However, when I try to populate the ...
Hepatitis asked 8/4, 2015 at 12:35
9
Constructing a wtforms' TextAreaField is something like this:
content = wtf.TextAreaField('Content', id="content-area", validators=[validators.Required()])
How can I specify the number of rows a...
3
Solved
I am currently rendering several Flask fields (SelectFields, InputFields) using the following jinja2 template:
<div>{{ wtf.form_field(form.blockingProbability) }}</div>
This results ...
Scorpion asked 5/7, 2015 at 9:57
1
Solved
I have a form where users can dynamically add fields to it. While submitting this form, backend only sees the fields which backend generated
#forms.py
class ExpensesForm(FlaskForm):
expense_name...
6
I am trying to generate a form in WTForms that has dynamic fields according to this documentation http://wtforms.simplecodes.com/docs/1.0.2/specific_problems.html#dynamic-form-composition
I have t...
2
Solved
I want a DateField which is optional,
but I got a "Not a valid date value" error if leave it empty
I add some logs in the source code of wtforms, and found
formdata.getlist(self.name) returns [u''...
Sneeze asked 4/1, 2015 at 14:18
1
I am currently trying to build a simple web application using Flask. With this i am also using WTForms, however i am having problem with getting date information from the form and getting it valida...
Internecine asked 3/4, 2018 at 15:3
3
I have a form contains name and pictures
MyForm:
name = TextField(
u'name',
validators=[
validators.DataRequired(),
validators.Length(min=1, max=25)
]
)
pictures = FileField(
u'pictures...
Hashum asked 17/5, 2014 at 0:23
1
Solved
This is what I have tried:
nrkomp = IntegerField('Number',validators=[NumberRange(min=1, max=5, message='Invalid length')])
In developer tools, this form input has type text and not number, I ha...
9
Solved
Hi I have been trying to pepopulate a textareafield using something
like this in the template.
{{form.content(value="please type content")}}
This works when the field is textfield primarily beca...
5
Solved
Choices can be set using form.myfield.choices=[("1","Choice1"), ("2","Choice2")]
What is the way to set the selected option?
4
Solved
Currently in WTForms to access errors you have to loop through field errors like so:
for error in form.username.errors:
print error
Since I'm building a rest application which uses no form view...
1
Solved
What is the best way to validate a WTform based on two or more entries? I.e. in the form below I want to validate that a company with the provided name and address do not already exist in the datab...
Lysias asked 2/9, 2018 at 5:23
1
I have a form that I want to automatically fill some of the fields with information received on a previous page, but it needs to be changeable if they want to adjust it. I am using a dynamically cr...
Tackle asked 23/7, 2018 at 16:43
1
Solved
After select2 manipulates the dropdown field the regular use of form.owner_id.data yields None. How can I extract the selected option from a select2 field.
If I disable the select2 javascript, wt...
Donohoe asked 24/7, 2018 at 16:11
2
Solved
This [example][1] to set up a form with WTForms and SQLAlchemy in Flask and add a QuerySelectField to the form works. I am not using flask.ext.sqlalchemy, my code:
ContentForm = model_form(Content...
Callant asked 5/2, 2014 at 13:58
2
Solved
I'm using WTForms to display and validate form input. I use a DecimalField for a money amount input, which works fine when inserting a value with a dot as a decimal separator. Since this website wi...
2
I'm trying to create a simple WTForms-based admin interface for an SQLAlchemy app, using Jinja2 templates.
I've read the docs of WTForms-Alchemy and I understand that it can auto-generate a form f...
Mariannemariano asked 1/12, 2015 at 3:10
2
Solved
I want to populate a select field based a query search.
But I also want an empty option.
This is my current code
form.state.choices=[(s.id, s.name) for s in State.query.all()]
the result is
...
Brewing asked 1/12, 2016 at 8:13
5
Solved
I'm having trouble populating a form using a dictionary:
row = {'firstname':'Bob', 'lastname': "Smith",
'email': '[email protected]', 'phone': '512.999.1212'}
form = RolodexEntry(obj=row)
...
Butterfly asked 1/5, 2013 at 21:53
4
Solved
I have a form, that will be used for a new submit and updates. My question is about the text of the submit button. I want to change the text to New submit and to New update, depending on the situat...
Dumbbell asked 20/8, 2015 at 0:1
1
Solved
Flask wtforms - 'UnboundField' object is not callable, dynamic field won't init properly
app.py
from flask import Flask, render_template
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, FieldList, FormField
app = Flask(__name__)
app.config['SECRET_KEY'] =...
Outgoings asked 9/2, 2018 at 0:36
3
Solved
Is there any way to strip surrounding whitespace from all values in WTForms without adding a filter to every single field?
Currently I'm passing filters=[strip_whitespace] with the function shown ...
© 2022 - 2024 — McMap. All rights reserved.