populate sum of 4 number fiels in other field dynamically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 01:27 AM
Hi,
i have a requirement that in the for there r 4 fields A,B,C,D currency fields or number fiels when i enter this values in the form it should do sum of all these a+b+c+d and populate in other field called E before saving form it self it should calculate and populate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 01:57 AM
Hi @dixitreddy ,
You have 4 fields and if you create OnLoad client script it works on only one field. For example you created onLoad client script on Field A and if you didn't change the value of field A the script will not work.
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 01:54 AM
Hi @dixitreddy ,
I tried with OnSubmit client script it works for me please check below code
function onSubmit() {
//Type appropriate comment here, and begin script below
var fieldA = g_form.getValue('u_a');
var fieldB = g_form.getValue('u_b');
var fieldC = g_form.getValue('u_c');
var fieldD = g_form.getValue('u_d');
alert('A = ' + fieldA + " B = " + fieldB + " C = " + fieldC + " D "+ fieldD);
var e = parseInt(fieldA) + parseInt(fieldB) + parseInt(fieldC) + parseInt(fieldD);
alert("E - " + e);
g_form.setValue('u_e', e);
}
Result
Total in E
Please mark my answer correct and helpful if this works for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 02:11 AM
will it work on onchange? before saving form i need sum of values to populate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 03:00 AM
Hi @dixitreddy ,
This is will on OnChange client script for example if you apply OnChange Client script on field D, so each and everytime you need to change the value of field D to calculate the sum of all 4 fields
Please mark my answer correct and helpful if this work for you
Thanks and Regards
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2024 04:22 AM
on change will work only in one field at a time i want to enter 4 values and it should do sum then the on change wont work here