not with createargs, editargs, etc etc etc . in fact, the thing you want to do isn't accompilished by passing a parameter in a SQLFORM, so these "xxxxargs" are useless to your ends. to "prefill" a value just set its default before returning the grid..... logic is up to you.
def test(): db.table2.table1.default = request.args(0) ....... if I got what you're triyng to do. On Friday, January 18, 2013 5:32:24 PM UTC+1, Tito Garrido wrote: > > Sorry, I still don't get how to use it... > example: > db.define_table('table1', > Field('name', requires=IS_NOT_EMPTY()), > ) > db.define_table('table2', > Field('name', requires=IS_NOT_EMPTY()), > Field('table1', 'reference table1', requires = IS_IN_DB(db, > db.table1.id,'%(name)s')), > ) > > Then I have: > table1_id=request.args(0) > query_table2=db(db.table2.table1==table1_id) > > form=SQLFORM.grid(query_table2.query,user_signature=False,args=request.args[:1],formargs={'table1':table1_id}) > > The way that is set above it does not work... I would like to pre-fill the > 'table1' field when I am adding/editing to hide this field on grid... > > How can I do that? > > > On Fri, Jan 18, 2013 at 12:56 PM, Niphlod <nip...@gmail.com > <javascript:>>wrote: > >> the same args you'd want to pass to a SQLFORM you can pass them to >> createargs, formargs, etc etc etc. >> >> code on the grid basically does this .... >> >> sqlformargs = dict(formargs) >> >> sqlformargs.update(createargs) >> create_form = SQLFORM( >> table, ignore_rw=ignore_rw, formstyle=formstyle, >> _class='web2py_form', >> **sqlformargs) >> >> so, formargs is for whatever arg you choose to pass to EVERY form >> generated by the grid, while the other are specific to the action the form >> is tied to. >> >> >> >> >> On Friday, January 18, 2013 3:59:12 PM UTC+1, Tito Garrido wrote: >>> >>> I have read the book on http://web2py.com/books/** >>> default/chapter/29/07#SQLFORM.**grid-and-SQLFORM.smartgrid<http://web2py.com/books/default/chapter/29/07#SQLFORM.grid-and-SQLFORM.smartgrid>but >>> the explanation about these args are too poor... how to use it? Is >>> there any example? >>> >>> Thanks, >>> >>> Tito >>> >>> -- >>> >>> Linux User #387870 >>> .........____ >>> .... _/_õ|__| >>> ..º[ .-.___.-._| . . . . >>> .__( o)__( o).:_______ >>> >> -- >> >> >> >> > > > > -- > > Linux User #387870 > .........____ > .... _/_õ|__| > ..º[ .-.___.-._| . . . . > .__( o)__( o).:_______ > --