trigger question

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

trigger question

Postby Martin Pruss » Fri May 16, 2008 12:41 pm

:?:
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
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby Martin Pruss » Sat May 17, 2008 1:21 am

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
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby Martin Pruss » Sat May 17, 2008 1:23 am

the code tags of phpbb are filtering out code as well :cry:
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby shannah » Sat May 17, 2008 5:46 pm

If you check the "Disable HTML in this post" option, it will prevent it from eating the code.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Sat May 17, 2008 5:47 pm

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();
    ....
}
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Martin Pruss » Sun May 18, 2008 7:56 am

<thanks>yep ...works</thanks>
cheers
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

errors or messages

Postby Martin Pruss » Mon May 19, 2008 1:58 pm

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
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby meta » Wed Jun 18, 2008 4:08 am

Hi Martin,

maybe you look here:

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

Could be a part of your solution.

Markus
meta
 
Posts: 30
Joined: Mon Nov 12, 2007 8:30 am
Location: Berlin, Germany


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 33 guests

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