Duke3D
Member
I have a calc element that works correctly on Save with either a button group or dropdowns.
Two issues:
1) If source element is displayed as button group, Ajax calc is not triggered regardless of whether element or element_raw is in the watchlist for the calc itself.
This is reported in https://github.com/Fabrik/fabrik/issues/1224 as being solved/closed, but apparently I do not know how to correctly trigger it. Is some JS needed to tickle the watcher?
2) If source is changed to a dropdown, the Ajax calc returns "undefined," but the total is still correct on save whether element or element_raw is used in the calc.
The dropdown values/radio buttons are integers (scores of 1-9)
I am using the syntax suggested in the popup:
<code>return (int)'{lpc_evaluations___score1}' + '{lpc_evaluations___score2}';</code>
What should I try next to get same result from Ajax as calc?
I tried wrapping with intval() in case the issue is selecting the radiobuttons plugin is force-casting the field as SQL type TEXT.
<code>return (int)intval('{lpc_evaluations___score1}') + intval('{lpc_evaluations___score2}');</code>
But no joy.
I'm guessing this is because the Ajax execution of this PHP is more sensitive to data type. Any other ideas?
Two issues:
1) If source element is displayed as button group, Ajax calc is not triggered regardless of whether element or element_raw is in the watchlist for the calc itself.
This is reported in https://github.com/Fabrik/fabrik/issues/1224 as being solved/closed, but apparently I do not know how to correctly trigger it. Is some JS needed to tickle the watcher?
2) If source is changed to a dropdown, the Ajax calc returns "undefined," but the total is still correct on save whether element or element_raw is used in the calc.
The dropdown values/radio buttons are integers (scores of 1-9)
I am using the syntax suggested in the popup:
<code>return (int)'{lpc_evaluations___score1}' + '{lpc_evaluations___score2}';</code>
What should I try next to get same result from Ajax as calc?
I tried wrapping with intval() in case the issue is selecting the radiobuttons plugin is force-casting the field as SQL type TEXT.
<code>return (int)intval('{lpc_evaluations___score1}') + intval('{lpc_evaluations___score2}');</code>
But no joy.
I'm guessing this is because the Ajax execution of this PHP is more sensitive to data type. Any other ideas?
Last edited: