Access form data with custom php code

Access form data with custom PHP code in ChronoForms.

Overview

The issue occurs when using an outdated variable reference to access form data, which triggers a PHP undefined variable error.
Use the correct method to retrieve form data by referencing the manual and applying the proper syntax.

Answered
ChronoForms v6
Jo Joao Serina 31 Jan, 2018
I have a multipage form and I would like to add some custom PHP validation when moving to the next page on some of the fields.
I have placed a debugger at the start of the second page so that I can see the information I'm getting followed by the php code but, when I try to access $form->data['input-name'] I get a PHP error: "Notice: Undefined variable: form in (...)".
st stami 31 Jan, 2018
1 Likes
In chronoforms v6 you have to use: $this->data('inputname');
Gr GreyHead 31 Jan, 2018
Answer
Hi Joao,
Please see page 34 in the manual.
Bob
Jo Joao Serina 31 Jan, 2018
This is going to sound strange but I had done that and it wasn't working for some reason but now it is!
Thank you very much for the quick reply Bob!😀
This topic is locked and no more replies can be posted.