Skip to main content

This method using button to submit. Before save/update record, system will read first what value you fill-in into the field (RecordStatus)

 


//Verify Empty Field Before Submit (before add /update)

//IF CLICK BUTTON SUBMIT
//review is Button ID
if($_REQUEST[“review“])

{

$data = array();

//recordStatus is fieldname
//Review is value to check
$data[“recordStatus“] = “Review“;

//project is table name & id is table id
$result = DB::Update(“project“, $data , “id=”.$values[“id“]);

//proName is field for verify
if ($values[‘proName‘]==””)
{

// Set an error message
$message = “cannot be empty when Record Status is ‘Review’.”;

// Return false to prevent the record from being saved
return false;

}

}