Filters

A place for users and developers of the Xataface to discuss and receive support.

Postby siainmi » Mon Oct 01, 2007 6:12 am

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!
siainmi
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Mon Oct 01, 2007 9:43 am

Yes,

Use the beforeInsert trigger:
function beforeInsert(&$record){
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( $user ) $record->setValue('group', $user->val('group'));
}
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby siainmi » Tue Oct 02, 2007 12:10 am

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!
siainmi
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Tue Oct 02, 2007 12:27 am

Try
widget:type=hidden
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby siainmi » Tue Oct 02, 2007 7:02 am

HI!!
Works! as usually!
Thx For all!!
siainmi
 
Posts: 30
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 13 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved