He actually (kinda) answered all three.
However, I've just made a slight tweak to the PHP form plugin that will make this easier. So, grab the latest github, and ...
Put your functions in a file, and store them in the PHP plugin scripts dir which is at ./plugins/fabrik_form/php/scripts. (NOT the path Rob gave you).
Select that file in the PHP plugin's PHP File.
Call the function from the PHP Code box, passing in any args you need.
Simple example I tested with:
File is called my_funcs.php, which is:
PHP:
<?php
function saySomething($msg, $formModel) {
$example_element_value = $formModel->getElementData('fab_calc_test___calc_test_2', false, 'default value');
$app = JFactory::getApplication();
$app->enqueueMessage($msg . ": " . $example_element_value);
return true;
}
?>
Then in the PHP Code box, I have:
PHP:
saySomething("Value is", $formModel);
Net result is, after submitting the form, J! shows a standard status message at the top of the page, saying:
Value is: cheesegrits
Note that I pass in $formModel, which is usually the main Fabrik "thing" you'll be wanting to operate on, and is in scope when we eval your code .. but not within any functions in your file, unless you 'global' it, which is a frowned upon these days, so you'll need to pass it in as an arg. And as per the tooltips, you'd then be able to use $formModel->updateFormData() to modify form data.
Final note, you could do this without updating form github, by just not selecting a PHP File, and doing (more or less) what Rob said to do:
PHP:
require_once JPATH_ROOT . '/plugins/fabrik_form/php/scripts/my_funcs.php';
saySomething("Value is", $formModel);
The only difference with the tweak I just did in github is to make it easier to include that file, i.e. we do the require_once for you.
-- hugh