Ajax calc in repeated group

Status
Not open for further replies.

lori19

Active Member
Hi all !

I'm not sure if this is an issue or a suggestions for future development.

I have this repeated group that does some simple calculation (sum) of some of its fields. Works fine for one instance of the group, but when I want to add one more, the calculations fail. The calc has, obviously, to deal with two set of fields to add and it seems no means to tell which ones belogn to which group. I can see that the fields are named differently in the group instances, so I assume that the issue lies with the ajax script. Or is it my PHP code in the calculation? It looks like this:

$LTotal = "";
$LTotal=(int)'{student_11_repeat___amount}'+(int)'{student_11_repeat___charges}';
return number_format($LTotal);

Thanks for any suggestions!

Joomla 4.2.9 (fresh install) F4.gamma3, PHP 8.1
 
Thanks for the hint. After digging around a bit I narrowed it down to the following:

- In the frist repeat instance everything works fine.
- When I open the second instance, the values of the calc field of the first instance are displayed.
- Inserting the amount and charges values, the value in the calc field does not change.
- Changing the values in the first instance leads to the correct result in the calc field.
- After saving the form, and re-entering it via edit, all values are correct and the calc fields are updated as it should be when I change one or more of the values it is based on.

I also shortened the calcualation to :

return (int)'{student_11_repeat___amount}'+(int)'{student_11_repeat___charges}';

thinking that variable $LTotal might "breed through".

It seems to be an issue when opening a new instance and displaying its elements.
 
Should be fixed in the next release.

You can try:
In plugins\fabrik_element\calc\layouts\fabrik-element-calc-form.php line 16
add class fabrikinput
so
<div class="fabrikinput form-control-plaintext....
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top