that works for a form but not for smartgrid. you can try this (a hack):

   if request.vars.file != None:
      db.client.filename.default = request.vars.file.filename
   form  = SQLFORM.smartgrid(db.client, fields=fields, linked_tables=['file'
])


On Friday, 22 March 2013 16:14:58 UTC-5, James Burke wrote:
>
> I'm having trouble working this one out. I've tried using the example in 
> the book with no success.
>
> Model:
>
> db.define_table('file',
>    Field('client', 'reference client'),
>    Field('file', type='upload', autodelete=True),
>    Field('filename', 'string'),
>    format='%(file)s')
>
> Controller:
>
> def client():
>    fields = dict(client=[db.client.company_name, db.client.live, db.client
> .contact_name, db.client.billing_code])
>    form  = SQLFORM.smartgrid(db.client, fields=fields, linked_tables=[
> 'file'])
>
>    if request.vars.file != None:
>       form.vars.filename = request.vars.file.filename
>
>    return dict(form=form)
>
> Any help is appreciated.
>
> -James
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to