fieldname__default Delegate Class Method

Return to Delegate class methods

Synopsis

Xataface allows you to pre-populate any particular field in a table by adding a fieldname__default method to the table’s delegate class of the form:

function fieldname__default(){
    return value;
}

Returns the default value for the field fieldname. New record forms will be prepopulated with this value.

Examples

function minimum_bid__default(){
    return 100;
}
function mydatecol__default(){
    return date('Y-m-d');
}
function owner_id__default(){
    $auth =& Dataface_AuthenticationTool::getInstance();
    $user =& $auth->getLoggedInUser();
    if ( isset($user) ) return $user->val('userid');
    return null;
}

See Also