This topic is locked
[SOLVED]

 JavaScript alert on list page - Custom button

6/16/2011 1:45:50 AM
PHPRunner General questions
M
macalister author

Hello.
I have a custtom button on a list page.
I need to show an alert that depends of a condition (OnServer). For example:

if(condition){

.

.

.

show alert

}
else{

.

.

.

show alert
}


I'm trying to show the alerts with

echo '<script> alert("Message");</script>';

but nothing happens. What is the right way to show alerts in "OnServer" area buttons?
Thanks for your help and time.

C
cgphp 6/16/2011

You have to show the alert in the "OnAfter" section not in the "OnServer" section.
In the "OnServer" section you could set a var like this:

$result['test'] = 1;


In the "OnAfter" section you can test the server var:

if(result['test'] == 1)

{

alert("Message");

}
M
macalister author 6/21/2011

Thanks !! works perfectly...