fabrik fields to variables php

imagenweb

New Member
hello how can I convert the data from field to variable
I want to add an external php file
using php form plugin


attached image to explain better

thanks

"maybe my question is very silly, but I'm new to fabrik"

fabrik-plugin_form_php.jpg
 
Firstly, there is no such thing as a silly question, always ask!

OK ... if you are using an included PHP file, then you can't use the {table___element} placeholders. Those only work with "inline" code (not from a file), where we substitute the values before eval'ing the code.

In a file, you can use the $formModel->getElementData() method:

PHP:
$foo = $formModel->getElementData('yourtable___foo');

For elements which have the concept of a "value" and a "label" (like dropdowns, database joins, etc), that will give you the label. To get the "raw" value, use :

PHP:
$foo = $formModel->getElementData('yourtable___foo', true);
In a form submission plugin, to change the value of the submitted data, use the updateFormData() method:

PHP:
$formModel->updateFormData('yourtable___foo', $foo);

Again, to set a "raw" value (like setting a database join element's value), add true ...

PHP:
$formModel->updateFormData('yourtable___foo', $foo, true);

NOTE that this will only work in the plugin hooks that happen BEFORE the data is actually processed and stored, like onBeforeProcess or onBeforeStore.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top