ga.n,
thanks for the hint.
However, it seems to me that the formula is not being processed (parsed). I can see the field values in the result page but I don't see the result of the formula.
Questions:
1. Where and how do I load the hook (loadFormfield)? I didn't need to use it yet, so I am not familiar with it...
2. Where do I actually initiate the formula-processing? As far as I understood, this has to be done in the result-page but how??
Or is this a redundant question?
Puzzled,
Erhard
Addendum:
From my logic, it was more approbiate to use the "processData"-Hook, since I want to calculate a result from a formula.
So I tried this:
system/modules/GetGradeLength/config/config.php:
Code:
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
$GLOBALS['TL_HOOKS']['processFormData'][] = array('GetGradeLength','findgradelen');
?>
system/modules/GetGradeLength/GetGradeLength.php:
Code:
<?php if (!defined('TL_ROOT')) die('You cannot access this file directly!');
class GetGradeLength extends Frontend
{
public function findgradelen($arrPost,$arrForm,$arrFiles)
{
if($arrPost['FORM_SUBMIT'] == 'auto_form_19')
{
// Get values from form fields:
$this->He = $arrPost['He'];
$this->Ha = $arrPost['He'];
$this->Sl = $arrPost['Sl'];
$this->Di = $arrPost['Di'];
//Compute formula:
$this->Di = ($this->He - $this->Ha) * bcsqrt(1 + (10000 / bcpow($this->Sl,2,2)));
// Write result to form field
$arrPost['Di'] = $this->Di;
}
}
}
?>
I don't see a result though. Any idea what I am missing?
Thanks,
Erhard
Bookmarks