Re: [web2py] Temporary changing default values of a Form

2011-07-05 Thread Luis Goncalves
I found the answer searching through the group posts: form.element(_name='email')['_readonly']=True although this doesn't seem to be documented in the manual, and even looking through the gluon directory (and grepping for _readonly ) didn't reveal anything. Would this have been obvio

Re: [web2py] Temporary changing default values of a Form

2011-07-05 Thread Luis Goncalves
One more question: How do I make the pre-populated elements of the form appear read-only (so that they cannot be altered)? I've tried in the view: {{=form.custom.begin}} First name: {{=predef.fname}} Last name: {{=predef.lname}} Email: {{=predef.email}} Password: {{=for

Re: [web2py] Temporary changing default values of a Form

2011-07-05 Thread Luis Goncalves
That worked great!!! Thanks so much, Anthony!!! L. On Tue, Jul 5, 2011 at 10:23 AM, Anthony wrote: > I'm not sure you can pre-populate a registration form that way. > form.vars.email has to be set after the form is created but before > form.accepts is called -- however, auth.register() creates

Re: [web2py] Temporary changing default values of a Form

2011-07-05 Thread Anthony
I'm not sure you can pre-populate a registration form that way. form.vars.email has to be set after the form is created but before form.accepts is called -- however, auth.register() creates the form and calls form.accepts. Instead, you can pre-populate by manipulating the form DOM directly: f

Re: [web2py] Temporary changing default values of a Form

2011-07-05 Thread Luis Goncalves
This doesn't seem to work with auth() forms: form = auth.register() form.vars.email = 'l...@vision.caltech.edu' return dict(form=form) doesn't show the predefined value for 'email' in a view that renders {{=form}} Does anybody know why? Thanks!! Luis.

Re: [web2py] Temporary changing default values of a Form

2011-01-20 Thread Kenneth Lundström
> Does anybody know how to do it for a select box? > Select box is rendered because it's a foreign key that reference another table. After you have created the form but before if form.accepts define your default. form = SQLFORM(db...) form.vars.type = 'cleaner' if form.accepts.. T

Re: [web2py] Temporary changing default values of a Form

2011-01-20 Thread Arun K.Rajeevan
Does anybody know how to do it for a select box? Select box is rendered because it's a foreign key that reference another table.

Re: [web2py] Temporary changing default values of a Form

2011-01-04 Thread Kenneth Lundström
There is atleast two other ways of doing this in the controller on-the-fly. Before you create the FORM object you can do: db.table.field.default = 0 (you temporarly change what you have defined i models) or after you have created the FORM but before if form.accepts form.vars.field = somethin

[web2py] Temporary changing default values of a Form

2011-01-04 Thread Fabiano - deStilaDo
Hi, I have a default value for a field defined on the table definition, along with its validators. I want to create a form with a different initial value for some fields, based on the link the user clicked. Something like "add new item for this category" and the new item form come with that categ