Form data initialization

3 views
Skip to first unread message

Terrence Brannon

unread,
Oct 25, 2008, 6:15:02 AM10/25/08
to nagare...@googlegroups.com
On line 33:
http://www.nagare.org/trac/browser/trunk/nagare/examples/nagare/examples/form.py#L33

the password data is set to 'secret'

On line 161:
http://www.nagare.org/trac/browser/trunk/nagare/examples/nagare/examples/form.py#L161

the password is rendered, but the field starts out as empty instead of
with the data 'secret' entered.


Why is that.

apoirier

unread,
Oct 28, 2008, 2:39:04 PM10/28/08
to Nagare users
On Oct 25, 11:15 am, Terrence Brannon <metap...@gmail.com> wrote:
> On line 33:http://www.nagare.org/trac/browser/trunk/nagare/examples/nagare/examp...
>
> the password data is set to 'secret'
>
> On line 161:http://www.nagare.org/trac/browser/trunk/nagare/examples/nagare/examp...
>
> the password is rendered, but the field starts out as empty instead of
> with the data 'secret' entered.
>
> Why is that.

Because the password field is not automagically bound to the
``password`` property.

To fill it with the ``password`` value, you need to set its ``value``
attribute:

h << 'Password:' << h.input(type='password', length=10,
value=self.password()).action(self.password)

(of course, as this is a password field, the caracters will be
displayed masked)
Reply all
Reply to author
Forward
0 new messages