preRemove validation
preRemove validation
KeepMoving
Posts: 28Questions: 7Answers: 0
Hi,
Im trying to prevent to remove yourself from the list
->on( 'preRemove', function ( $editor, $id, $values) {
$activeId=$values['usuario']['IdUsuario'];
$sessionId=$_SESSION['IdUsuario'];
if( $activeId== $sessionId){
//then what?
}
} )
after validate how can I cancel or send a message to prevent deletion of that row?
This discussion has been closed.
Answers
return false;
will stop the row being deleted.However, perhaps a better way would be to have a validator on the
IdUsuario
field which you could run your check on. That way you can easily return an error message to the client-side.Allan
You mean something like this?
That looks like Javascript rather than PHP. I had been meaning the PHP
preRemove
event like you had in your original code. Something like:Allan