PHP return value not displaying in field

How to fix a PHP return value not displaying in a ChronoForms field.

Overview

The issue occurs when the PHP action is placed incorrectly in the form processing order or when the field reference syntax is wrong.
Ensure the PHP action is positioned above the Display section action in the form and verify the field uses the correct variable reference syntax.

Answered
ChronoForms v6
Ro Roaf 23 Jan, 2018
Hello, I have the following bit of php code:

$res_amount =& $form->data['res_amount'];
$time_res =& $form->data['time_amount'];
$total_price = 0;


$total_price = $res_amount + $time_res;

return $total_price;


When I debug, the return and var are both set to the correct amount, like 12.98, but the field its supposed to go to appears empty still.

I have a 'total' field reloaded on a "price" event upon choosing a reservation time. The total field has value of {var:php15} which happens to be php code.

Any ideas?
Max_admin Max_admin 25 Jan, 2018
Hi Roaf,

The PHP action should be ABOVE the "Display section" action, is it ?

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Ro Roaf 29 Jan, 2018
Answer
1 Likes
Wrong syntax on my end. I figured it out.

Thanks for the reply!
This topic is locked and no more replies can be posted.