Twitter Feed

Xataface Maillist

Sign up to receive the Xataface news letter with weekly updates and development tips.

Found 1 of 138 records in table Wiki
Now Showing 1 of 1

Current Record: fieldname__validate

fieldname__validate Delegate Class Method


Return to Delegate class methods

Table of Contents


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;


  • &$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 a boolean value. True if the value is ok and false if validation failed.

See Also

blog comments powered by Disqus
Powered by Xataface
(c) 2005-2018 All rights reserved