⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Javascript confirmation in add_action



Felipe Saraiva
  • profile picture
  • Member

Posted 12 December 2015 - 12:05 PM

I need a javascript confirmation window before the action, is possible to do this?
My code:
 
$crud->add_action('EXCLUIR', '', '', 'ui-icon-trash', array($this, 'botaoExcluir'));

function botaoExcluir($primary_key, $row) {
     return "<script>alert('test');<script>";
}

 

Thanks for help!

 


Amit Shah
  • profile picture
  • Member

Posted 18 January 2016 - 13:48 PM

Hi Felipe Saraiva,

 

I will suggest you return "javascript:somefunction()" rather then the script code. By doing this, you can then give the alert popup or whatever you want to achieve with it.

 

Happy GCing :)