0

I have the following HTML, CSS and JS code. However, when I use the search from the top right side and press enter. Flask only get "None" and what was typed in search.

This is the route for the search:

@app.route("/quick_search/", methods=("GET", "POST"))
@app.route("/quick_search/<property_id>")
def quick_search(property_id=None):
    form = QuickSearch()
    print "???", form.propert_name.data

and this form class:

from flask.ext.wtf import Form
from wtforms import SelectField, StringField, IntegerField, SelectMultipleField

class QuickSearch(Form):
    propert_name = StringField()

Why I only get None from form.propert_name.data?

user977828
  • 7,259
  • 16
  • 66
  • 117

1 Answers1

1

You name your field propert_name in the WTForms instance and in the Flask view. But in the HTML it is called quick_search.

You also use the attribute type twice in the inputtag. You say type="text" and then you redefine type to submit later on. This shouldn't cause the problem, but worth it to take care…

cuducos
  • 730
  • 6
  • 17