This topic is locked
[SOLVED]

alert message in a custom button

4/26/2024 2:17:29 AM
PHPRunner General questions
ffrinai author

I have a custom button with only a message in server tab:
echo "<script>alert('my message');</script>";
when the buttun is pressed the message is correctly displayed
but after click OK in the message box, the
Server error occurred. See details is displayed on the top of the page
the error details are:
[]
open and close square brackets !
what am I missing?

thanks for help
Fabio
phprunner enterprise 10.91 build 41629 PHP Version 8.1.12

Admin 4/26/2024

Everything is wrong here.

  1. Displaying a message in the browser needs to be done in Javascript
  2. Outputting anything in button's Server code will break the whole button's code. Server part of the code is executed via AJAX, on the server and you cannot display anything from there. This explained in great details in the manual

The correct approach is to use a Javascript event, like ClientBefore or ClientAfter. You can either use an alert() or better yet, SWAL:
https://xlinesoft.com/phprunner/docs/sweetalert2.htm

ffrinai author 4/29/2024

hi,
sweetalert2 doesn't appear in the runner manual of phprunner build 41619 that I use, and if I use swal.fire no popup appears, does any configuration need to be set?
thanks
Fabio

Admin 4/29/2024

How can you say that it is not in the manual if I have sent you a link to that article?

In either case, Swal.fire() and swal.fire() are two different things. Do not invent new syntax, copy and paste examples from the manual.

ffrinai author 4/30/2024

hi,
I'm sorry, I made a syntax error.
In the local help of Phprunner Enterprise build 41619 x64 the sweetalert2 part is not present (see attached image) as in the online manual.
img alt
Thank you for your always precious help.
Fabio