Page 1 of 1
How to set success message,terminate page from global code
Posted: Thu Sep 12, 2013 10:14 am
by Bishu
I am writing a function in the global code and in the function I have to set a success message and terminate the page.
e.g.
function myfunction(){
-----------------------------
$this->setSuccessMessage("Success");
$this->Page_Terminate("myurl");
}
Here I got a message as
"Fatal error: Using $this when not in object context in C:\wamp\www\cashsms\backend\userfn10.php on line 42"
As my function is in the global code $this is not in the object.
how can I handle this situation.
Re: How to set success message,terminate page from global co
Posted: Thu Sep 12, 2013 10:41 am
by Bishu
sorry for my silly question.
$this should be CurrentTable()
Re: How to set success message,terminate page from global co
Posted: Thu Sep 12, 2013 4:01 pm
by mobhar
Yep, as the help file said:
"If a server event is a global function, there is NO "$this" in the function context. If you want to refer to the current page object, you can use the global function CurrentPage()."
CurrentPage()->setSuccessMessage("Success");
CurrentPage()->Page_Terminate("myurl");