Haven't tried it, but something like this might also work:

grid = SQLFORM.grid(..., oncreate=lambda f: response.update(flash='Record 
Added!'), ...)

There's also an onupdate argument.

Anthony

On Monday, June 1, 2015 at 6:11:04 PM UTC-4, Massimo Di Pierro wrote:
>
> if grid.create_form and grid.create_form.accepted:
>     response.flash = 'record created'
> elif grid.update_form and grid.update_form.accepted:
>     response.flash = 'record updated'
>
> this should really go in the book
>
>
>
> On Monday, 1 June 2015 15:11:28 UTC-5, LoveWeb2py wrote:
>>
>> Thank you for the reply, Massimo!
>>
>> How can I make it say "Record Added!" when the SQLFORM.grid is processed? 
>> I know how to do it for SQLFORM, but not sure how to do it for the grid?
>>
>> On Monday, June 1, 2015 at 4:04:22 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> This should not be the case. they logic is unrelated. Something else is 
>>> going on.
>>>
>>> On Monday, 1 June 2015 14:21:50 UTC-5, LoveWeb2py wrote:
>>>>
>>>> Hello,
>>>>
>>>> Lets say I have
>>>>
>>>> grid=SQLFORM.smartgrid(db.table, formname="mytablename")
>>>> return dict(grid=grid)
>>>>
>>>> When I change the form name do I lose the ability to set 
>>>> response.flash? I changed the formname to one of my grid's and when users 
>>>> add a record now they don't get the response that a record was added.
>>>>
>>>> There has to be something for this that I couldn't find in the book
>>>>
>>>>
>>>>

-- 
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/d/optout.

Reply via email to