On Friday, May 12, 2017 at 2:13:31 PM UTC-7, Ben Lawrence wrote: > > I assumed the element was found because the button 'Add Record' did change > to 'Add Person' in the view... >
The line where you assign "Add Person" to addButton[0] is where you get the exception. I believe that says addButton is a NoneType, so you can't select [0] and assign to it. /dps > On Friday, May 12, 2017 at 1:59:47 PM UTC-7, Dave S wrote: >> >> >> >> On Friday, May 12, 2017 at 1:56:35 PM UTC-7, Ben Lawrence wrote: >>> >>> I did the same but did not work. The button changed to 'Add Person' OK, >>> but received an error when clicking button 'Add Person'. Is it because I am >>> using a different version of web2py 2016.05.10 ? >>> >>> addButton=alertGrid.element(_title='Add record to >>> database') >>> addButton[0]='Add Person' >>> addButton['_title']= 'Add Person to database' >>> >>> >>> <type 'exceptions.TypeError'> 'NoneType' object does not support item >>> assignment >>> >> >> I'd check what you have after the first line ... if addButton is a >> NoneType, then maybe the element wasn't found. >> >> /dps >> >> >> >>> Version >>> web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47 >>> Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr) Traceback >>> >>> 1. >>> 2. >>> 3. >>> 4. >>> 5. >>> 6. >>> 7. >>> 8. >>> 9. >>> 10. >>> 11. >>> 12. >>> >>> Traceback (most recent call last): >>> File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted >>> exec ccode in environment >>> File >>> "/home/www-data/web2py/applications/temperature/controllers/probe.py" >>> <https://firtreegrove.com/admin/default/edit/temperature/controllers/probe.py>, >>> line 129, in <module> >>> File "/home/www-data/web2py/gluon/globals.py", line 417, in <lambda> >>> self._caller = lambda f: f() >>> File "/home/www-data/web2py/gluon/tools.py", line 4241, in f >>> return action(*a, **b) >>> File >>> "/home/www-data/web2py/applications/temperature/controllers/probe.py" >>> <https://firtreegrove.com/admin/default/edit/temperature/controllers/probe.py>, >>> line 70, in edit >>> addButton[0]='Add Person' >>> TypeError: 'NoneType' object does not support item assignment >>> >>> -- 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/d/optout.