Xataface allows you to add validation on any particular field in table by adding a fieldname__validate method to the table's delegate class of the form:
function myfield__validate(&$record, $value, &$params){
if ( $value != 'Steve' ){
$params['message'] = 'Sorry you must enter "Steve"';
return false;
}
return true;
}
Parameters
&$record : A Dataface_Record object encapsulating the record we are validating. Note that the values of this object correspond with the submitted values from the form, and not necessarily the actual values of the record in the database.
$value : The value that is being inserted.
&$params : An output array that can be used to pass back a message if validation fails. You would set this array's 'message' parameter to be a message.
Returns
Returns a boolean value. True if the value is ok and false if validation failed.