Extension modules can be used to add your own form processing features to your form.
and so on.
The structure of an extension module
An extension module is written in PHP. You should be familiar with the syntax of PHP to write extension modules.
Your extension module should extend FM_ExtensionModule class.
The extension module below loads the form (the field 'Name')
class MyCustomLoadingModule extends FM_ExtensionModule
$formvars["Name"] = "Default Name";
The code above loads a field 'Name' with a default value. To see this code in action, put the code above in a file (say mymodule.php) Then Enable 'extension modules' in the 'Form processing options' page, and add the file in the 'Extension Modules' page.
The field "Name" will have the value "Default Name" when the form is loaded.
Of course, you can have more complex logic in your extension module.
The Function Reference contains the list of all the functions that you can override in your custom module.
Integrating the module with your form
In Simfatic Forms, first enable extension modules in the Form Processing Options Page.
In the 'Extension Modules' Page you can load your extension modules. Press the 'Add Module' button and select the file that you have created.
You can add any number of extension modules to your form. The overrides will be called one by one (in the order they appear in the 'Extension Modules' page )
Features available to the extension modules
The base class for the extension modules - FM_ExtensionModule class contains certain useful member objects.
You can use the Simfatic Forms standard logger in your extension module. The logged messages will appear in the log if you enable logging in your form. (Enable logging in 'Form Processing Options' page)
To Log an error, call LogError()function
$this->logger->LogError("Could not connect to the database")
To log an information message, call LogInfo() .
Form submission variables
The values submitted in the form are available in the member array $this->formvars
Handling errors in an Extension Module
To handle a critical error case in your extension module, make a call to the error_handler object.
"Error connecting to DB:".mysql_error());
Sample Extension Modules
There are some sample Extension Modules in the Simfatic Forms Installation folder(usually "C:\Program Files\Simfatic Solutions\SimfaticForms" ). Open the sub-folder "scripts\server\ExtensionModuleSamples". You will find some sample extension modules. The same folder contains some form template files as well. These sample modules will serve as a good starting point.