Page 1 of 1

PostPosted: Mon Oct 01, 2007 6:12 am
by siainmi
Hi! I 'have append in file fields.ini in directory Anagrafica (reference to table Anagrafica) this rows:

[__filters__]
group="$user->val('group')"

is possible to insert in field [group] of table Anagrafica value of [$user->val('group')] every once is insert new row in table Anagrafica?

Thank for help!

PostPosted: Mon Oct 01, 2007 9:43 am
by shannah
Yes,

Use the beforeInsert trigger:
function beforeInsert(&$record){
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( $user ) $record->setValue('group', $user->val('group'));
}

PostPosted: Tue Oct 02, 2007 12:10 am
by siainmi
Hi good!!
is possible to hide field group when add record? I try to use

[group]
visibility = hidden

i file fields.ini, but in insert new record still view group field!

PostPosted: Tue Oct 02, 2007 12:27 am
by shannah
Try
widget:type=hidden

PostPosted: Tue Oct 02, 2007 7:02 am
by siainmi
HI!!
Works! as usually!
Thx For all!!