I am a newcomer to JS and cannot seem to get this to work. I have a new record form for a project, in which I have multiple budget fields (currency) which I would like to have totaled to a "Total Direct Cost" field, also in the table/form. I have added several different forms of the JS below in the footer and in an HTML block in my caspio form, but have not been able to get this to work. Any suggestions on formatting, syntax errors, etc. would be much appreicated.
function calculate()
{
var laborbudget = document.GetElementById("InsertRecordLabor_Budget").value;
var materialbudget = document.GetElementById("InsertRecordMaterial_Budget").value;
var rentalbudget = document.GetElementById("InsertRecordRental_Fees_Budget").value;
var totaldirectcost = laborbudget + materialbudget + rentalbudget;
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
ktrav1331
I am a newcomer to JS and cannot seem to get this to work. I have a new record form for a project, in which I have multiple budget fields (currency) which I would like to have totaled to a "Total Direct Cost" field, also in the table/form. I have added several different forms of the JS below in the footer and in an HTML block in my caspio form, but have not been able to get this to work. Any suggestions on formatting, syntax errors, etc. would be much appreicated.
function calculate()
{
var laborbudget = document.GetElementById("InsertRecordLabor_Budget").value;
var materialbudget = document.GetElementById("InsertRecordMaterial_Budget").value;
var rentalbudget = document.GetElementById("InsertRecordRental_Fees_Budget").value;
var totaldirectcost = laborbudget + materialbudget + rentalbudget;
document.getElementById("InsertRecordTotal_Direct_Cost_Budget").value = totaldirectcost;
}
document.getElementById("caspioform").onsubmit=calculate
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.