How to add alertify?

I would like to auto open a notice message use alertify with condition

  1. When the user successfully login the website
  2. When the user add successfully record data to the table

in Global > Page_Head:
AddStylesheet(“alertify/css/themes/bootstrap.css”);
AddStylesheet(“alertify/css/alertify.css”);
AddClientScript(“alertify/alertify.min.js”);

  1. For login
    Client Script > other > Login Page > User LoggedIn:
    if (CurrentTime() < “23:00:00” ) {
    // $this->setSuccessMessage(“Thank You For Logged In…”);
    alertify.success(“Thank You For Logged In”);
    }
  2. For add record
    Server Event > Table Specific> common > Row Rendering:
    function Row_Rendering() {
    alertify.success(“Thank You For Logged In”);
    }

but nothing happen…

Any idea? (v2019)

Thanks You

nabilahasna wrote:

Client Script > other > Login Page > User LoggedIn:
if (CurrentTime() < “23:00:00” ) {
// $this->setSuccessMessage(“Thank You For Logged In…”);
alertify.success(“Thank You For Logged In”);
}

CurrentTime() is PHP, you cannot use it in JavaScript, and you should not compare dates as string. You can use JavaScript, e.g.

if ((new Date()).getHours() < 22) { // getHours() returns an integer number, between 0 and 23, see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours

}

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

function Row_Rendering() {
alertify.success(“Thank You For Logged In”);
}

alertify.success() is JavaScript, you cannot use it in PHP server side events, and you should not output in Row_Rendering(). You can use it in server side User_LoggedIn, e.g.

$this->setSuccessMessage(“Thank You For Logged In.”);

Thank You So Much.