Jim,

I've been curious about this myself.  Here is what I discovered.
Tested on 1.99.2. Should be adaptable to a custom form.

Obviously one would want something more sophisticated than a string
for the key value in a real app.

from controllers/dogs.py, for grid:

def index():
    grid = SQLFORM.grid(db.dogs)
    if len(request.args)>1 and request.args[-2] =='new':
        if grid[1].process().accepted:
            key='mykey'
            session.auth.hmac_key = key
            the_id = grid[1].vars.id
            redirect(URL('index', args=('edit', 'dogs', the_id),
hmac_key=key))
    return dict(form=grid)

for smartgrid:
def index():
    grid = SQLFORM.smartgrid(db.dogs)
    if len(request.args)>1 and request.args[-2] =='new':
        if grid[2].process().accepted:
            key='mykey'
            session.auth.hmac_key = key
            the_id = grid[2].vars.id
            redirect(URL('index', args=('dogs','edit', 'dogs',
the_id), hmac_key=key))
    return dict(form=grid)

On Nov 15, 4:10 pm, Jim Steil <[email protected]> wrote:
> Hi
>
> I'm implementing a custom 'add' form in my .smartgrid.  Once I've
> accepted the input values and updated the database I want to return the
> user to the page that got me to the add page.  If the page I'm returning
> to contains a .smartgrid then I need to pass in that user_signature
> thing.  I have no idea how to do that.  Can someone point me in the
> right direction?
>
> Also, what would be the 'proper' way to determine that page that sent me
> to my add page.  One that would work even if the page failed validation
> a couple of times before being used?
>
>      -Jim

Reply via email to