I see a couple ways to handle it.
1. Using a custom view, wrap the button html with an if statement
testing to see if request.args(1) == 'edit'. If so, then you are in the
edit form for the grid.
2. Specify a custom view based on request.args(1) == 'edit' and then
code the entire thing using custom forms -->
http://web2py.com/books/default/chapter/29/7#Custom-forms. Put your
buttons anywhere you like then.
I have code similar to this in a few of my controller methods:
if request.args(1) in ['new']:
response.view = 'applications/railUnloading.html'
form = grid.create_form
if request.args(1) in ['edit']:
response.view = 'applications/railUnloading.html'
form = grid.update_form
I then pass 'form' to the view and can use it as you would in the book
example above.
-Jim
On 5/1/2012 12:42 AM, Keith Edmunds wrote:
I have a SQLFORM.grid, and I want to add a button to the form used to edit
records (as called from the grid). Is that possible?