>
> Hi
>
> I have tested the NO ACTION and it gives some king of solution . I have 
> defined the following simple model
> db.define_table('table_parent',Field('parent_name'))
> db.define_table('table_child',Field('child_name'),
> Field('parentid', 'reference table_parent',ondelete='NO 
> ACTION',required=True ))
>
> with smart grid , on attempt to delete from parent table if there are a 
> child reference it display an error messgae 
> "An error occurred , Please reload the Page "  . That means the Form 
> continue to function without throwing a ticket .
>

No, the delete request is made via Ajax, and the message you see is the 
result of an error ticket being generated during an Ajax request. This is 
probably not the best approach. It's not a bad idea to set ondelete='NO 
ACTION', as that will enforce the desired behavior at the level of the 
database, but you should additionally implement code to catch such errors 
before they hit the database so you can catch them and display an 
appropriate message in the UI.

Note, if you use the "deletable" argument to the grid and specify a 
function to determine if a given record is deletable, then the "Delete" 
button will simply not be present for any non-deletable rows in the grid, 
which will prevent users from attempting illegal deletes to begin with. 
Note, though, that the query in the "deletable" function will be executed 
for each row shown in the grid.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to