Danny Posted January 12, 2018 Report Share Posted January 12, 2018 Here's what it looks like, I can't figure out why calculate2 function won't enter data into the table. <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_field1 = parseFloat(document.getElementsByName("cbParamVirtual2")[0].value); if (isNaN(v_field1)) v_field1 = 0; var v_field2 = parseFloat(document.getElementById("InsertRecordPrincipal_Portion").value); if (isNaN(v_field2)) v_field2 = 0; var v_field3 = parseFloat(document.getElementById("InsertRecordAdditional_Principal").value); if (isNaN(v_field3)) v_field3 = 0; var v_total = (v_field1 - v_field2 - v_field3); document.getElementById("InsertRecordPrincipal_Balance").value = (v_total); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onsubmit=calculate; function calculate2() { var v_field1 = parseFloat(document.getElementsByName("cbParamVirtual2")[0].value); if (isNaN(v_field1)) v_field1 = 0; var v_field4 = parseFloat(document.getElementById("InsertRecordInterest_Rate").value); if (isNaN(v_field4)) v_field4 = 0; var v_total = (v_field1 * v_field4/1200); document.getElementById("InsertRecordInterest_Portion").value = (v_total); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onsubmit=calculate; </SCRIPT> Quote Link to comment Share on other sites More sharing options...
MayMusic Posted January 12, 2018 Report Share Posted January 12, 2018 You are not calling the second function at all but you call the first one two time. You to change the last line to: document.getElementById("caspioform").onsubmit=calculate2; Danny 1 Quote Link to comment Share on other sites More sharing options...
dannylipman Posted January 12, 2018 Report Share Posted January 12, 2018 May thank you for time trying to help me. The first calculate works stand alone. When I add the calculate2 neither one works. here is what I have in the footer. <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_field1 = parseFloat(document.getElementsByName("cbParamVirtual2")[0].value); if (isNaN(v_field1)) v_field1 = 0; var v_field2 = parseFloat(document.getElementById("InsertRecordPrincipal_Portion").value); if (isNaN(v_field2)) v_field2 = 0; var v_field3 = parseFloat(document.getElementById("InsertRecordAdditional_Principal").value); if (isNaN(v_field3)) v_field3 = 0; var v_total = (v_field1 - v_field2 - v_field3); document.getElementById("InsertRecordPrincipal_Balance").value = (v_total); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onsubmit=calculate; function calculate2() { var v_field1 = parseFloat(document.getElementsByName("cbParamVirtual2")[0].value); if (isNaN(v_field1)) v_field1 = 0; var v_field4 = parseFloat(document.getElementById("InsertRecordInterest_Rate").value); if (isNaN(v_field4)) v_field4 = 0; var v_total = (v_field1 * v_field4/1200); document.getElementById("InsertRecordInterest_Portion").value = (v_total); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onsubmit=calculate2; </SCRIPT> Quote Link to comment Share on other sites More sharing options...
Danny Posted January 13, 2018 Author Report Share Posted January 13, 2018 22 hours ago, dannylipman said: May thank you for time trying to help me. The first calculate works stand alone. When I add the calculate2 neither one works. here is what I have in the footer. <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_field1 = parseFloat(document.getElementsByName("cbParamVirtual2")[0].value); if (isNaN(v_field1)) v_field1 = 0; var v_field2 = parseFloat(document.getElementById("InsertRecordPrincipal_Portion").value); if (isNaN(v_field2)) v_field2 = 0; var v_field3 = parseFloat(document.getElementById("InsertRecordAdditional_Principal").value); if (isNaN(v_field3)) v_field3 = 0; var v_total = (v_field1 - v_field2 - v_field3); document.getElementById("InsertRecordPrincipal_Balance").value = (v_total); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onsubmit=calculate; function calculate2() { var v_field1 = parseFloat(document.getElementsByName("cbParamVirtual2")[0].value); if (isNaN(v_field1)) v_field1 = 0; var v_field4 = parseFloat(document.getElementById("InsertRecordInterest_Rate").value); if (isNaN(v_field4)) v_field4 = 0; var v_total = (v_field1 * v_field4/1200); document.getElementById("InsertRecordInterest_Portion").value = (v_total); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onsubmit=calculate2; </SCRIPT> Quote Link to comment Share on other sites More sharing options...
MayMusic Posted January 19, 2018 Report Share Posted January 19, 2018 There is no syntax error in here as far as I see unless there is an issue with the second script. To figure it out remove the first part and only add the second one see if that works: <SCRIPT LANGUAGE="JavaScript"> function calculate2() { var v_field1 = parseFloat(document.getElementsByName("cbParamVirtual2")[0].value); if (isNaN(v_field1)) v_field1 = 0; var v_field4 = parseFloat(document.getElementById("InsertRecordInterest_Rate").value); if (isNaN(v_field4)) v_field4 = 0; var v_total = (v_field1 * v_field4/1200); document.getElementById("InsertRecordInterest_Portion").value = (v_total); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onsubmit=calculate2; </SCRIPT> Quote Link to comment Share on other sites More sharing options...
braxwell Posted July 19, 2018 Report Share Posted July 19, 2018 did you ever figure this one out - I am having the same issue? Quote Link to comment Share on other sites More sharing options...
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.