librelist archives

« back to archive

Jinja2 Text Input Remember

Jinja2 Text Input Remember

From:
Alasdair Macmillan
Date:
2010-11-03 @ 10:36
Hi

Maybe a dumb question but is there any way to make a jinja2 form remember 
the values in its fields when validating. So if say a field is missing at 
the moment my textareas don't wipe but my text inputs do (in Chrome but 
not Firefox)

AL

Re: [flask] Jinja2 Text Input Remember

From:
Dag Odenhall
Date:
2010-11-03 @ 10:49
On Wed, 2010-11-03 at 10:36 +0000, Alasdair Macmillan wrote:
> Hi
> 
> Maybe a dumb question but is there any way to make a jinja2 form 
remember the values in its fields when validating. So if say a field is 
missing at the moment my textareas don't wipe but my text inputs do (in 
Chrome but not Firefox)
> 
> AL

If you use a form library, it usually does that for you. Have you looked
at Flask-WTF?

http://packages.python.org/Flask-WTF/

If you do it manually you'll want something like,

<input value="{{ request.form.username }}" name="username" ...

Re: [flask] Jinja2 Text Input Remember

From:
Chaitanya Sharma
Date:
2010-11-03 @ 12:27
Adding to that question,

does Flask-WTF also allow me to check for cross-site request forgery?

Chaitanya

On Wed, Nov 3, 2010 at 4:19 PM, Dag Odenhall <dag.odenhall@gmail.com> wrote:

> On Wed, 2010-11-03 at 10:36 +0000, Alasdair Macmillan wrote:
> > Hi
> >
> > Maybe a dumb question but is there any way to make a jinja2 form remember
> the values in its fields when validating. So if say a field is missing at
> the moment my textareas don't wipe but my text inputs do (in Chrome but not
> Firefox)
> >
> > AL
>
> If you use a form library, it usually does that for you. Have you looked
> at Flask-WTF?
>
> http://packages.python.org/Flask-WTF/
>
> If you do it manually you'll want something like,
>
> <input value="{{ request.form.username }}" name="username" ...
>
>

Re: [flask] Jinja2 Text Input Remember

From:
danjac354@gmail.com
Date:
2010-11-03 @ 12:29
I think this answers your question:
http://packages.python.org/Flask-WTF/#configuring-flask-wtf

On 3 November 2010 12:27, Chaitanya Sharma <gopi.daiict@gmail.com> wrote:
> Adding to that question,
> does Flask-WTF also allow me to check for cross-site request forgery?
> Chaitanya
> On Wed, Nov 3, 2010 at 4:19 PM, Dag Odenhall <dag.odenhall@gmail.com> wrote:
>>
>> On Wed, 2010-11-03 at 10:36 +0000, Alasdair Macmillan wrote:
>> > Hi
>> >
>> > Maybe a dumb question but is there any way to make a jinja2 form
>> > remember the values in its fields when validating. So if say a field is
>> > missing at the moment my textareas don't wipe but my text inputs do (in
>> > Chrome but not Firefox)
>> >
>> > AL
>>
>> If you use a form library, it usually does that for you. Have you looked
>> at Flask-WTF?
>>
>> http://packages.python.org/Flask-WTF/
>>
>> If you do it manually you'll want something like,
>>
>> <input value="{{ request.form.username }}" name="username" ...
>>
>
>