No announcement yet.

Logout confirmation dialog box

  • Filter
  • Time
  • Show
Clear All
new posts

  • Logout confirmation dialog box

    I have a menu item that exits the main app and redirects to login. I would like for it to display a confirmation dialog "Are you sure you want to logout? Any unsaved data will be lost". Would I be able to achieve this with blank php? The only three events available in menu don't allow "Display an error message" or "Display a message". Would this be achievable with a PHP method? Is there anything to disallow a method from being called on one of the three menu events? I haven't tried working with PHP methods in SC yet so I have no idea.

  • #2
    Hi Ancr2001,
    Yes you can display a confirmation dialog.

    Example Logout confirmation dialog box
    1. You need a blank application with this PHP Script using javascript:
    PHP Code:
    echo "<script>
    if (confirm('Your question')) { 
       // do other thing

    2. Replace 'DESTINATION' to your login app, example: '../login_app/';
    3. Your logout link must point to this blank application.
    Last edited by hirambq; 02-27-2013, 05:16 PM.
    Best Regards
    Hiram BQ


    • #3

      I got it working but I need it to kill the session when you click OK. How do I do that since you can't put a macro in the script. Right now the else redirects to the login app and cancel takes you back to the menu. If I choose OK and click back and refresh after the redirect the menu comes back and the session is still active.


      • #4
        You can redirect using parameters.

        Example to kill / destroy session

        Replace your 'DESTINATION' with your login app like '../login_app/login_app.php?logout=1'; as you can see i add a '?logout=1', now in your login app you must destroy the session onload.

        PHP Code:

        Note: When your user is redirected with logout=1 the session will be destroyed.
        Last edited by hirambq; 02-28-2013, 04:28 PM.
        Best Regards
        Hiram BQ


        • #5
          Thanks! Works great. I had to modify the code a little because I was getting an undefined index error but now it works like a charm!

          PHP Code: