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__default

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-2017 All rights reserved