How to Check Old Record Before Add?
Hi,
Check old records fields for before add.
If there is the same date and user record, it will give a warning, and it will give a yes or no warning to save.
Hi,
Check old records fields for before add.
If there is the same date and user record, it will give a warning, and it will give a yes or no warning to save.
You may use Row_Inserting server to event to execute a query to check, e.g. you may use ExecuteScalar().
Can you explain this with an example code?
You may click above links, read the examples and try to put them together. If your code does not work, you may post it here for discussion.
My code:
function Row_Inserting($rsold, &$rsnew) {
$skontrol = ExecuteScalar("SELECT count(*) FROM e_egitim_plani_detay where salon = '".$rsnew["salon"]."' and tarih = '".$rsnew["tarih"]."'");
$etkontrol = ExecuteScalar("SELECT count(*) FROM e_egitim_plani_detay where egitmen = '".$rsnew["egitmen"]."' and tarih = '".$rsnew["tarih"]."'");
$tarih = date("d/m/Y", strtotime($rsnew["tarih"]));
if($etkontrol > 0){
$this->CancelMessage = "".$rsnew["egitmen"]." , $tarih tarihinde eğitimi bulunmaktadır, lütfen farklı bir eğitmen seçiniz.";
return false;
}elseif($skontrol > 0){
$this->CancelMessage = "".$rsnew["salon"]." , $tarih tarihinde eğitimi bulunmaktadır, lütfen farklı bir salon seçiniz.";
return false;
}else{
return TRUE;
}}
I want a popup to open instead of CancelMessage, and I want it to return true when you click yes, and return false when you click no.
As explained and replied:
viewtopic.php?t=41668