<https://lh5.googleusercontent.com/-qrlS92szKAE/T7Sbh21ZjPI/AAAAAAAAAGM/M4GpWU4XMjY/s1600/readonly.png>

<https://lh4.googleusercontent.com/-StOS7GeF4T8/T7Sba3P801I/AAAAAAAAAGE/JVsInDhicow/s1600/edit.png>
Thanks for that 
(mind in neutral)

(Seems to be a issue with tags on read only forms but will try to work 
around that)

On Thursday, May 17, 2012 12:41:48 PM UTC+10, Massimo Di Pierro wrote:
>
> Assuming SOLIDFORM is an SQLFORM
>
> form1 = SOLIDFORM(db.Sample, q1, fields=fields1, readonly=True)
>
> q1 should be a record id or a Row object. You are passing a Rows object.
>
> On Wednesday, 16 May 2012 21:32:08 UTC-5, Simon Ashley wrote:
>>
>> Any one with any ideas on this one?
>> (been trying to trouble shoot it all morning)
>>
>> Environment: Version 1.99.4 (2011-12-31 04:51:15)
>>
>> Getting the following error, and unable to work it out.
>> (have other areas using soldiform that are working OK)
>>
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\restricted.py", line 204, in restricted
>>     exec ccode in environment
>>   File "C:/web2py/applications/tree/controllers/stree.py" 
>> <http://127.0.0.1:8000/admin/default/edit/tree/controllers/stree.py>, line 
>> 310, in <module>
>>   File "C:\web2py\gluon\globals.py", line 172, in <lambda>
>>     self._caller = lambda f: f()
>>   File "C:/web2py/applications/tree/controllers/stree.py" 
>> <http://127.0.0.1:8000/admin/default/edit/tree/controllers/stree.py>, line 
>> 302, in SV2
>>     form1 = SOLIDFORM(db.Sample, q1, fields=fields1, readonly=True)
>>   File "applications\tree\modules\plugin_solidform.py", line 94, in __init__
>>     SQLFORM.__init__(self, *args, **kwds)
>>   File "C:\web2py\gluon\sqlhtml.py", line 805, in __init__
>>     v = record['id']
>>   File "C:\web2py\gluon\dal.py", line 6532, in __getitem__
>>     row = self.records[i]
>>
>> *TypeError: list indices must be integers, not str*
>>
>>
>> *Model*
>> db.define_table('Sample',
>>     Field('Compartment', db.Compartment),
>>     Field('Date', 'date'),
>>     Field('Comments'),
>>     Field('Pb', 'integer'),
>>     Field('Fe', 'integer'),
>>     Field('Al', 'integer'),
>>     Field('Cu', 'integer'),
>>     Field('Cr', 'integer'),
>>     Field('Sn', 'integer'),
>>     Field('Ni', 'integer'),
>>     Field('Si', 'integer'),
>>     Field('Na', 'integer'),
>>     Field('Mg', 'integer'),
>>     Field('Zn', 'integer'),
>>     Field('Mo', 'integer'),
>>     Field('Ca', 'integer'),
>>     Field('P', 'integer'),
>>     Field('Bo', 'integer'),
>>  
>>     format='%(Date)s %(id)s')
>>
>> *Controller*
>> Methods 2 and 3 work, 1 doesn't
>> *
>> *
>> def SV2():
>>     session.sample = 1
>>     
>>     q1 = db(db.Sample.id == session.sample).select()
>>     #q2 = db.Sample.id == session.sample
>>     #q3 = db.Sample.id == session.sample
>>     fields1 = ['Date','Comments','Fe','Cu','Cr']
>>     #fields3 = ['Date','Comments','Fe','Cu','Cr']
>>     
>>     form1 = SOLIDFORM(db.Sample, q1, fields=fields1, readonly=True)
>>     #form2 = SQLFORM.grid(q2, searchable=False, 
>> create=False,csv=False,editable=False,deletable=False, sortable=False )
>>     #form3 = SQLFORM(db.Sample, session.sample, fields=fields3, 
>> readonly=True)
>>     
>>     return dict(form=form1) #does not work
>>     #return dict(form=form2) #works
>>     #return dict(form=form3) #works
>>
>

Reply via email to