Hi Guys, I want to do some arithmetic method, I have some field i.e. (Mortgage,
Loans, Final expenses, etc). All I need want to add these fields and store them in another field (Total-A). By using hook I’m getting my result when save event performed. But I need an automatic update addition method and show in (Total_A) field without clicking on the save button.
@omee
You should write javascript code. After that this code can load through file editviewdefs.php. For example look at ‘includes’ in modules/Accounts/metadata/editviewdefs.php
And another hint: the fields in forms have ids, that’s quite useful for accessing their value, like
$( "#name" ).val();
let’s say you want to calculate the difference between fields a and b and put the result in field c:
//will be triggered on change in one of the two fields
$( "#aID, #bID" ).change(function() {
var a = $( "#aID" ).val();
var b = $( "#bID" ).val();
$( "#cID" ).val(a-b);
});
by the way, if you’re doing custom js anyways, you could also do css modifications with this kind of script (e.g. highlight a cell red when the value undercuts a threshold or something like that).
Thanks Guys, It’s working.