Really struggling to understand forms with additional PHP.

classixuk

New Member
I've made a practice installation of a Fabrik form here: http://www.haircolourgenie.hairdressingworld.com/index.php?option=com_fabrik&view=form&formid=5

At the "end of form submission" I have placed the following php code:

Code:
$target = $formModel->getElementData'{search___TARGETSHAD}';


if ($target == "10") {
    return "Have a good day!";
}

I have done the above to see if it will trigger the 'return', but that doesn't happen. :(

I've tried echo instead of return, and I have tried replacing the {} with () too.

I've searched and searched the forums - will I ever get the hang of this? Please can somebody point out what I have done incorrectly? :(
 
http://fabrikar.com/forums/index.php?wiki/php-form-plugin/
Syntax of $formModel->getElementData is (assuming this is a correct full element name)
$target = $formModel->getElementData('search___TARGETSHAD');

return (on end of form submission) won't display anything, what do you want to achieve?
There are other hooks (getTop/BottemContent) or you have to create a system message or stop form submission and create an error message (onBeforeProcess)
 
End of form submission won't show an echo, because we always do a redirect after the submission is complete, so any echoed output just goes nowhere. We send a redirect back to your browser, which then reloads the appropriate page (either the list you came from, or wherever a form redirect goes).

-- hugh
 
Thanks for the replies guys.

The echoed content was there as I was hoping to create a 'trigger' that I could "see" - simply to check my syntax while I learn how to use the form component.

Is there any 'trigger' you can suggest that I use in my form whilst I am learning Fabrik, so that I can see if each line of php I insert has had the desired effect?

Thanks.
 
You can do
echo 'xy';exit;
of for debuging variables
var_dump($x);exit;
which will give you a blank screen with just the output.
 
We are in need of some funding.
More details.

Thank you.
Back
Top