HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   Developers' Forum (
-   -   onBeforeInsert generating table value (

mare 14th January 2013 18:46

onBeforeInsert generating table value

I use onBeforeInsert in my table_edit.php to generate a value which should be added to the database (will come from another subsystem so it's not available during the form input).

currently i do the following but thing there is a better solution .


function onBeforeInsert()
              global $app
              $app->tform->errorMessage = myfunction($_POST) ;
              $this->dataRecord['value'] = $_SESSION['value'] ;
              unset ($_SESSION['value']) ;


global $_SESSION ;
if (ok)
$_SESSION['value'] = "foo";
return "error foo :-(" ;

till 14th January 2013 18:55

May you describe a bit more what you try to do. ISPConfig has various methods to validate and filter user input incl. custom validators and custom datasources for values. A custom validator or custom datasource is a php class which can handle nearly any kind of value and the validators and datasources are just configured in the tform file, there is no overriding of onBeforeInsert nescessary then.

mare 16th January 2013 15:15

I have a form with Value A and B

What i tried to find out was how to :

Entering Value A into a form --> submit the form --> use onBeforeInsert function in myform_edit.php to generate Value B and store this into the table.

So Value B is not entered by the user but generate by ispconfig.

I found that i simply can use $page->dataRecord['B'] = $result['object'] ; to fill B.

till 16th January 2013 16:54


I found that i simply can use $page->dataRecord['B'] = $result['object'] ; to fill B.
Yes, thats correct. If B is defined in the tform file as table field, you can set B in dataRecord in any event function that gets executed before the insert or update happens.

All times are GMT +2. The time now is 22:05.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.