Page 1 of 1

trigger question

PostPosted: Fri May 16, 2008 12:41 pm
by Martin Pruss
:?:
Hi Steve
can I use the method : after_action_edit() in dataface-0.7.1 ?
when I try the following:
function after_action_edit(&$record){
//comment
}
I get this error:
Warning: Missing argument 1 for tables_neu_fragen::after_action_edit() in /path/to/website/dataface-0.7.1/partner/tables/neu_fragen/neu_fragen.php on line 17

or does the method refer to $record automatically?

I have do do some calculations when the record has been edited and update some fields depending on these calculations.
my first try looks like this:
---------------------snip----------------------------------
function after_action_edit(&$record){
//calculate the difference
$auth =& Dataface_AuthenticationTool::getInstance();
$groesse_sch = $record->val('schuhgroesse');
$fussgroesse_re = $record->val('fussgroesse_re');
$mod_re = $record->val('mod_re');


if ($groesse_sch - (($fussgroesse_re*3)) <0>setValue('mod_re', $mod_re_neu);}

}
---------------------snap------------------------------------

maybe you'll find the time to provide a simple example of the after_action_edit method

I still hesitate to upgrade to the last xataface release because i made some changes to the dataface core, and unfortunately i forgot to document it....(very professional...isn't it?)
thanks
and greetings from Berlin
Martin

PostPosted: Sat May 17, 2008 1:21 am
by Martin Pruss
mmmhh..
phpbb eats code!
the excerpt above should be:
Code: Select all

if ($groesse_sch - (($fussgroesse_re*3)) <0>setValue('mod_re', $mod_re_neu);}

cheers
Martin

PostPosted: Sat May 17, 2008 1:23 am
by Martin Pruss
the code tags of phpbb are filtering out code as well :cry:

PostPosted: Sat May 17, 2008 5:46 pm
by shannah
If you check the "Disable HTML in this post" option, it will prevent it from eating the code.

PostPosted: Sat May 17, 2008 5:47 pm
by shannah
The reason for the error is that the after_action_edit trigger doesn't take any parameters. If you want to get the current record you would have to do this:

Code: Select all
function after_action_edit(){
    $app =& Dataface_Application::getInstance();
    $record =& $app->getRecord();
    ....
}

PostPosted: Sun May 18, 2008 7:56 am
by Martin Pruss
<thanks>yep ...works</thanks>
cheers

errors or messages

PostPosted: Mon May 19, 2008 1:58 pm
by Martin Pruss
Hi Steve
I'd like to, sort of "trace" my calculations in the message box(just for testing), You know , the one where "Record successfully saved" appears. Later i'd like to customize the messages relating on these calculations. I know i have done this already with dataface two years ago but i simply forgot how and i also could not find it in the documentation.
do You have an idea?

thanks in advance
Martin

PostPosted: Wed Jun 18, 2008 4:08 am
by meta
Hi Martin,

maybe you look here:

http://xataface.com/documentation/tutor ... ucess_page

Could be a part of your solution.

Markus