Hi Jim, thanks for you reply. Sorry I guess I should be more specific. I 
have a SQLGRID form (displaying contents of table db.nextpasses) , In the 
SQLFORM.grid I have inserted a button called addpass so for every record in 
the SQLgrid I have a button addpass. When clicking "addpass" another form 
"addpass" is opened which should be pre-populated from the record values in 
the SQLform.grid in the previous form.

maybe something like this

 sgrid = SQLFORM.grid(db.nextpasses, 
links=addpass(db.addpass.field_name.default = db.nextpasses.field_name

I am bit confused where I need to pass the values when initiating the lamba 
project addpass.

thanks,
John




On Tuesday, February 11, 2014 10:16:28 PM UTC+1, Jim S wrote:
>
> Try setting the defaults on the respective fields:
>
> db.nextpasses.field_name.default = default_value_for_this_field
>
> -Jim
>
> On Tuesday, February 11, 2014 10:51:29 AM UTC-6, John Philip wrote:
>>
>> Hi there,
>>
>> I am a newbie to web2py. I did try to look for similar threads but 
>> couldn't find a solution specifically for my problem. I want to 
>> pre-populate a form from a current record in the SQLFORM.grid. 
>>
>> addpass = [lambda project: A('add pass', _class="btn", 
>> _href=URL("default","addpass"))]
>> # added a link button to open form addpass which should have 
>> pre-populated fields in sgrid shown below.
>>
>>  sgrid = SQLFORM.grid(db.nextpasses, links=addpass, create=False, 
>> editable= False, deletable=False, 
>> fields=[db.nextpasses.DOY,db.nextpasses.STATION,db.nextpasses.BOT,db.nextpasses.EOT],
>>  
>> maxtextlength=50,headers={'nextpasses.DOY' : 'DOY','nextpasses.STATION' : 
>> 'Station', 'nextpasses.BOT' : 'Aos', 'nextpasses.EOT' : 'Los'})
>>
>> Any help would be greatly appreciated!
>>
>> many thanks and regards,
>>
>> John Philip
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to