Saltar navegación

[Resuelto] cred_save_data don't work

This support ticket is created hace 3 años, 4 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por aitorS hace 3 años, 4 meses.

Asistido por: Minesh.

Autor
Mensajes
#2141789

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: enlace oculto

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>';
}
}

#2141933

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

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;
}
}
#2141969

My issue is resolved now. Thank you!