Current Record: fieldname__default #133

Return to Delegate class methods Table of Contents Synopsis Examples See Also Synopsis Xataface allows you to pre-populate any part...

Current Record: fieldname__default #133

Return to Delegate class methods Table of Contents Synopsis Examples See Also Synopsis Xataface allows you to pre-populate any part...

fieldname__default Delegate Class Method

[Permalink]

Return to Delegate class methods

Table of Contents

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

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