>
> While I have found the example apps and docs good, there is one glaring 
> omission - how to do updates/edits in forms. For example I worked through 
> the 'dogs' example app - nice and clear....but what I'd like to see is a 
> section detailing how to:
>
> - search for a dog (say by name)
>

The only built-in methods for searching (via the user interface) are 
crud.search and SQLFORM.grid (and .smartgrid).

def search_dogs():
    form, records = crud.search(db.dog)
    return dict(form=form, records=records)

or

def search_dogs():
    return dict(form=SQLFORM.grid(db.dog))  # or 
form=SQLFORM.smartgrid(db.dog) to access linked tables

- update/edit the various attributes for the dog concerned
>

Update forms are explained 
here: 
http://web2py.com/books/default/chapter/29/7#SQLFORM-and-insert/update/delete. 
Just pass the record as the second argument to SQLFORM. Note, if you use 
grid/smartgrid, this is all handled automatically.

Anthony

 

Reply via email to