Re: [flask] Question about Flask and WTForms
- From:
- Aaron Kavlie
- Date:
- 2011-02-26 @ 19:06
I think what you want is the FieldList:
http://wtforms.simplecodes.com/docs/0.6.2/fields.html#field-enclosures
You should be able to add a field to the form with append_entry(). A more
user-friendly (but non-trivial) option is to append an entry via JS, without
a round-trip to the server. That requires copying, incrementing numbers
where they appear (the hard part), then appending to the DOM. I plan to do
this myself in an app I'm working on in the future.
I don't know of any preexisting example code for this, but I've seen it for
Django, which has a similar construct.
On Sat, Feb 26, 2011 at 10:35 AM, Eric Seidel <gridaphobe@gmail.com> wrote:
> Hi, I have a question about using Flask and WTForms. I'm working on a
> simple resumé building application, and I want to add my employment history.
> Since I've had multiple jobs, it seems to make the most sense to have a
> basic job form that can be duplicated by some kind of javascript. I'm pretty
> new to web apps though, so I'm not exactly sure how to do this, or how
> Flask-WTF would handle these forms on the backend (would 'form' be a list of
> forms, i.e. form[0].company.data?). I'd appreciate it if someone could give
> me an example, or point me to a nice tutorial :)
>
> Thanks,
>
> Eric Seidel
>
>