I have made the following customizations to the TableName_Before_Insert function of a table named Appointments at the Appointments.php file under the Hooks folder (code generated with the latest version of Appgini):
Code: Select all
function Appointments_before_insert(&$data, $memberInfo, &$args){
// Check if the Name and Surname exist in the WatchList. If yes insert an ALERT message to the Comments field
// and show a warning alert message to the user
$name=$data['Name'];
$surname=$data['Surname'];
$res=sql(
"SELECT firstname, lastname " .
"FROM WatchList WHERE " .
"UPPER(FirstName) = UPPER('$name') and " .
"UPPER(LastName) = UPPER('$surname')"
, $eo);
//Check if query brings up any results then show alert message and put a color coded message in the Comments field of the appointment and bring up the ALERT
if(mysql_num_rows($res)){
$data['Comments'] = '<b><font color="#E56717">***ALERT. Check Watch List for details!***.</font></b>' . $data['Comments'];
do_alert("CAUTION:A person with the same Name and Surname was found in Watch List...");
}
return TRUE;
}
Code: Select all
function do_alert($msg)
{
echo '<script type="text/javascript">alert("' . $msg . '"); </script>';
}
Following another discussion http://forums.appgini.com/phpbb/viewtopic.php?f=7&t=565 I tried to use the Modalbox.show insted of the above Javascript do_alert function but I get an error that the function is undefined.
So, I wanted to ask what has caused the Javascript Alert function to stop functioning in this case and what should I do to display a warning message to the user when there is a match in if(mysql_num_rows($res)) {...} code ?
Thank you very much in advance
Vassilis