multiple fields calculation to update a single single
I have like 9 fields then there a math formula i need to run and show the result on another field, is there a way to to this without using the AfterStateUpdate and duplicate the formula on each of the 9 fields and then update the value on the result field?
12 Replies
do it the opposite way round
instead of using a field, use a placeholder with dynamic content to display the result
then use $get to get the values of the fields and return the result
but if the fields are updated it the placeholder also update
right now what i did was placed the formula inside re result field, with the afterstateupdated
then on all other files did a $set to set the value to 0 on the result field and it will trigger the updated status again to recalculate
all the fields on the 3 right fieldsets are the values used to calculate the total neg comission
but its nor working i think
when updating via set does not triger the afterstateupdated
let me try with the label
please send the code you tried with the Placeholder
im still trying with place holder trying to search how how to make it dinamic
content(fn ($get) => $get('field_name') + $get('field_name'))
working now, just need to apply some css to make it look like a disabled field
And its now done with placeholder
thanks a lot
but with the label i cant save this value do DB right?
do it in an observer
if this was a field, the user would have been able to change the value maliciously via javascript
yes for this thats not a issue its a private application they will be digging for those workarounds, but its better that way anyway