[web2py] Re: prepolutating a SQLFORM.factory form

2010-04-16 Thread salbefe
Thanks all, Now is more clear to me. -Salva On 16 abr, 19:23, mdipierro wrote: > I would recommend > >     db.data.field.default='value' >     form = crud.create(db.data, onaccept=give_update_permission) > > Massimo > > On Apr 16, 11:20 am, Mathieu Clabaut > wrote: > > > I have used form.eleme

[web2py] Re: prepolutating a SQLFORM.factory form

2010-04-16 Thread mdipierro
I would recommend db.data.field.default='value' form = crud.create(db.data, onaccept=give_update_permission) Massimo On Apr 16, 11:20 am, Mathieu Clabaut wrote: > I have used form.element to prepopulate a form : > >     form = crud.create(db.data, onaccept=give_update_permission) > >  

Re: [web2py] Re: prepolutating a SQLFORM.factory form

2010-04-16 Thread Mathieu Clabaut
I have used form.element to prepopulate a form : form = crud.create(db.data, onaccept=give_update_permission) # add current date as default form form.element('input', _name="date")['_value'] = > time.strftime("%Y-%m-%d") At this point, form is still not a string but an HTML Helper

Re: [web2py] Re: prepolutating a SQLFORM.factory form

2010-04-16 Thread Thadeus Burgess
Because SQLFORM builds the HTML as soon as you instantiate the class. So you cannot edit anything after you create your form, since all of the html is already built, in strings. Specifying the default is the way to go here (annoying... I know). I usually perform the following if record_id: re

[web2py] Re: prepolutating a SQLFORM.factory form

2010-04-16 Thread salbefe
Thank you Massimo, But db.user.id.default = user.user.id db.user.name.default = user.user.name db.user.email.default = user.user.email db.addr.city.default = user.addr.city is the rigth way to preopulate a SQLFORM.factory form? Why not once the form is define

[web2py] Re: prepolutating a SQLFORM.factory form

2010-04-16 Thread mdipierro
There is not such function. I think by if change_user_data(user): he actually means if user is allowed change do what he is trying to do: depending on the logicl you may not need this if statement at all. Massimo On Apr 16, 6:55 am, salbefe wrote: > Hello, > > I have a