Because in my case the record is not deleted simply deactivated. But there are other scenarios: - Making additional checks before allowing the record deletion; - Asking for the password of a supervisor before allowing the record deletion; - Making some changes to other tables as a consequence of the record deletion; - Wanting to receive an email when someone deletes a record from a special table; - Doing some house keeping or some other task when someone deletes a record.
There are 5 options when entering the grid's edit: 1. The user checks the record and decides to delete it without making any changes, selects the delete checkbox and submits. 2. The user makes some changes that are valid and then decides to delete the record and submits both the valid changes (which don't get saved) and the delete checkbox selected. 3. The user makes some changes that are not valid (eg. changing a unique field to a value that already exists) and submits. He receives the validation error message, corrects the value to a valid one and then decides to delete the record and submits with the delete checkbox selected. 4. The user makes some changes that are not valid (eg. changing a unique field to a value that already exists) and submits. He receives the validation error message, doesn't correct the value and decides to delete the record and submits with the delete checkbox selected. 5. The user makes some changes that are not valid (eg. changing a unique field to a value that already exists) and then decides to delete the record and submits both the invalid changes and the delete checkbox selected. In 1, 2 and 3 web2py calls onvalidation. But not on 4 and 5 (which submit the same information, an invalid value and the delete checkbox selected). That is the problem here. quarta-feira, 10 de Abril de 2019 às 20:38:17 UTC+1, Anthony escreveu: > > I found a bug in the grid's edit validation. >> I follow this procedure: >> - Select a record to edit. >> - Change one of the fields that must be unique and change it to a value >> that already exists. >> - web2py shows an error message (which is correct and happens before >> going to onvalidation, which is also correct). >> - Change the value to something that doesn't already exist in the table. >> - Mark the record for deletion. >> - Submit the record. >> >> The bug I found is that web2py was supposed to go to onvalidation before >> deleting the record and that doesn't happen. >> > > If the record is being deleted, why would you need to validate the > submitted values (given that they will not be applied)? > > 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.