bmtadmin Posted May 7, 2015 Report Share Posted May 7, 2015 New Caspio user and trying to create two javascript actions (concatenate & calculate) in a submission form datapage. I have the following fields in the form which I am trying to work with: 1: "Quantity" & "Measurement" | concatenate | "Qty_Plus_Measurement" ("Measurement" is a cascading dropdown) 2: "Quantity" & Unit_Price | calculate | "Total_Price" After testing, neither script is working...My footer script is below. <!-- Responsive Code Begin --> </div> <!-- Responsive Code End --> <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var position1 = document.getElementById("InsertRecordQuantity").value; var position2 = document.getElemenstByName("InsertRecordMeasurement")[0]; var allpositions = position1 + position2; document.getElementById("InsertRecordQty_Plus_Measurement").value = allpositions; } document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> function calculate() { var v_price = parseFloat(document.getElementById("InsertRecordUnit_Price").value); var v_quantity = parseFloat(document.getElementById("InsertRecordQuantity").value); var v_total = (v_Unit_Price * v_Quantity); document.getElementById("InsertRecordTotal_Price").value = Math.round(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...
Jan Posted May 8, 2015 Report Share Posted May 8, 2015 Hello bmtadmin, Welcome to Caspio Forum! As far as I know, you can use "onsubmit" action only once. I have edited your code: <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var position1 = document.getElementById("InsertRecordQuantity").value; var dropdown = document.getElemenstByName("InsertRecordMeasurement")[0]; var position2 = dropdown[dropdown.selectedIndex].value; var allpositions = position1 + position2; document.getElementById("InsertRecordQty_Plus_Measurement").value = allpositions; var v_price = parseFloat(document.getElementById("InsertRecordUnit_Price").value); var v_quantity = parseFloat(document.getElementById("InsertRecordQuantity").value); var v_total = (v_Unit_Price * v_Quantity); document.getElementById("InsertRecordTotal_Price").value = Math.round(v_total); } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onsubmit=calculate; </SCRIPT> I hope, it helps. Quote Link to comment Share on other sites More sharing options...
Meekeee Posted December 17, 2018 Report Share Posted December 17, 2018 Hi @bmtadmin, As of July 12, 2018, Caspio introduced new features which you can find here: https://howto.caspio.com/release-notes/caspio-bridge-13-0/ This release includes a new feature, Calculated Values in Submission Forms. This allows you to generate calculations which you can use for your total price. Check these videos for more information: I hope this helps! 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.