Displaying a confirmation Dialog from a trigger

Hello everybody.

using the Project Modul of Dolibarr, we would like to create the Directory-Structure (file-server) of the Project automatically by dolibarr. Therfore i’ve used the Trigger PROJECT_CREATE.

If the Project is deleted i’d like to delete the directory’s too - after a confirmation. And thats the point. I can write a Message out of the Trigger, wich confirms that the directory’s have been created, but i’m not able to show a dialog box like that one, which is shown if I want to delete a Project (confirm_delete)

Is there a possibility to show a dialog box? Or is that programmed for each modul seperately?

Please Help.

BR
Guenther

hello,
you should use hooks to show your dialog box; triggers are good for background tasks but hooks are made for front end.

1 Like

Hello,

thank you for your answer, i will try that!

Is there a function/interface to display a dialog box?

BR
Guenther

May be by injecting jquery javascript on page ( using hooks of oage), you can be able to add your own confirm popup instead of default one. It does not look easy. You can t use triggers for interaction.

1 Like

Hello,

now i got the hooks working, but how can i show the conformation popup?

In my doActions Function, the code

if ($action == 'delete_DIR')
{
    $amaConform = new Form($db);
    $text='<br>'.img_warning().$langs->trans("DelProjDirConfirm");
    print $amaConform->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("DelProjDirTitle"),$text,"confirm_delete_DIR",'','',1);
}

is working so far, but how can i show the confirmation popup? Thers no error message, but no popup is displayed… :unhappy:

Please help! :happy:

Thank you
Guenther

I have exactly the same problem,
It looks like function $form->formconfirm returns always an empty string.
Is there a solution to this need?
Thanks
Marcello

Sorry i have’nt found a solution yet…