if grid.create_form or grid.update_form: grid.element(_type='submit')[
'_value'] = T("something")On Wednesday, 2 October 2013 23:15:07 UTC-5, P T wrote: > > Hello All, > > > I want change the label of Submit button in the SQLFORm.grid. I found two > solutions in the forum and both seems to be not working. > > The first solution given here Changing SQLFORM.grid submit label from > python without > javascript?<https://groups.google.com/forum/#!searchin/web2py/sqlform.grid$20submit$20label/web2py/NCYWvrJMeWM/RMgZNZbGSC8J> > > is > > grid.element(_type='submit')['_value'] = T("something") > > But, the above code is changing the label of the "Search" button. > > The second solution given here SQLFORM.RID > Selectable<https://groups.google.com/forum/#!searchin/web2py/grid.element($27.web2py_table$20input%5Btype$3Dsubmit%5D$27)/web2py/HzjctWX6qYM/ogILzykUPq4J> > is > > grid.element('.web2py_table input[type=submit]')['_value'] = T('something' > ) > > This indeed changes the label of the Submit button but break the > functionality of other buttons such as Edit, View and Delete and issues a > ticket. > > What I am doing wrong? By the way I am using the latest version > 2.6.4-stable+timestamp.2013.09.22.17.43.26 on Windows 7 and here is the > controller function: > > def listscenarios(): > query = (db.scenario.created_by == auth.user.id) > grid = SQLFORM.grid(query, > links = [lambda row: A(I('',_class="icon-picture")+' Results',_class > ='btn', _href=URL("default","calculate", args=[row.id], user_signature= > True, hash_vars=True))], > selectable=lambda ids: compare(ids), csv=False, > fields=[db.scenario.id, db.scenario.name, db.scenario.description, > db.scenario.avg_mass, db.scenario.cell_type, db.scenario. > tap_charge, db.scenario.first_cycle, db.scenario.reverse_cycle], > oncreate=scenario_create) > > > ## grid.element('.web2py_table input[type=submit]')['_value'] = > T('Something') ## this causes problems with View and Edit buttons > ## grid.element(_type='submit')['_value'] = T("something") ## this > chnages the label of the Search button? > grid.element('.web2py_counter', replace=None) > > > return dict(grid=grid) > > > > Thanks, > PT > -- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

