Page 1 of 1

calculated field or/and automatically calculate and print

PostPosted: Thu Feb 16, 2012 6:31 am
by sgaget
I have in my table "ttt", two fields ttt_a and ttt_b.

How can I automaticly compute a third field ttt_c to be ttt_a*ttt_b?

I tried with the functions beforeSave or after_action_edit in the file
ttt/ttt.php with the instruction :
$record->setValue('ttt_c', $record->val('ttt_a')*$record->val('ttt_b'));

But it doesn't work! ;-(


I know this third field ttt_c is not necessairy because it's calculate. Therefore is it a way in the view page, the new entry page or in the modify page to have the ttt_a*ttt_b result near the widget label? (and automatically update when ttt_a or ttt_b is changed?)

Thanks and congratulation for Xataface.

Re: calculated field or/and automatically calculate and prin

PostPosted: Wed Feb 22, 2012 12:33 pm
by shannah
This should have worked in the beforeSave() method.