• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

wtform SelectField has empty data

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I looked for a flask/django forum on Coderanch but couldn't find one so I went with the next best thing;

So I'm completely stumped on this and it's frustrating I will explain why.

First here's my form class in routrs.py;



// The countries


I have a piece of javascript code that inserts data into a select field with the "attractions" class when the user select a country from a list on the same page. It works as expected.

I can access the form country (as in form.country.data) in my routing function calc():


However form.data.attractions returns the empty list '[]'
Even when I select different countries the form.attractions.data always return an empty list '[]'

The QUESTION: How can I access dynamically modified fields (modified by javascript) in flask.

And in my javascript file I have



Affected HTML code



I have looked around but couldn't find anyone with this exact same problem
Getting form.attractions.data is important because It's used to determine various fields in the rendered template that is returned


Thank you.
 
James Harrison
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I basically broke the step into two.
I made a separate html page for the attractions and passed the selected country (form.selected.data) from the original form (on submission) to the routing function defined for the second html page.

something like this;
 
reply
    Bookmark Topic Watch Topic
  • New Topic