I setup some fields as required fields. When I try to add a record without filling in the fields, I get a popup window saying the fields are required...then it adds the record anyways. I do have a event setup before the record is added and am wondering if the event is resetting a error flag or something? If I use a event to check for duplicate records, do I have to do all edit checking in here?
Here is my be event...
function BeforeAdd(&$values)
{
// Parameters:
// $values - Array object.
// Each field on the Add form represented as 'Field name'-'Field value' pair
//** Check if specific record exists ****
global $conn;
$strSQLExists = "select * from brands where brand_pname=".$values["brand_pname"]. " or brand_name =".$values["brand_name"];
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
// if record exists do something
echo $values["brand_name"]. " or " .$values["brand_pname"]. "already exists in Brands Master";
return false;
}
else
{
// if dont exist do something else
}
return true;
// return true if you like to proceed with adding new record
// return false in other case
}