I am trying to execute a code after saving data with a toolset input form, to test the operation of the code I have this test, but when I save it it does not launch the alert, what is wrong?
URL edit form: hidden link
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==967)
{
echo'<script type="text/javascript">alert("Tarea Guardada");</script>';
}
}
Hello. Thank you for contacting the Toolset support.
Toolset form API hook should not be used to hook the JavaScript code.
If you want to test the hook is called or not you should try to use the following code:
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data){
// if a specific form
if ($form_data['id']==967){
var_dump($_POST);
exit;
}
}