zalipresents Posted September 7, 2016 Report Share Posted September 7, 2016 Can someone help with this javascript please...I'm using a submission form and one of the fields in the calculation is a cascading dropdown with a parent of Merchandise_ID and the other is a text input field. Not sure why its not working, but nothing is showing up in the destination field. <strong><span style="color:#000000;"></span></strong> <strong><span style="color:#000000;"> <div id="mypage1"> </div> <SCRIPT LANGUAGE="JavaScript"> function calculate() { var Gross_Qty_Sold = isNaN((parseFloat(document.getElementById("InsertRecordGross_Qty_Sold").value)))?0:(parseFloat(document.getElementById("InsertRecordGross_Qty_Sold").value)); var Merchandise_Cost = isNaN((parseFloat(document.getElementsByName("InsertRecordMerchandise_ID_Merchandise_Cost")[0].value)))?0:(parseFloat(document.getElementsByName("InsertRecordMerchandise_ID_Merchandise_Cost")[0].value)); var total= (Gross_Qty_Sold * Merchandise_Cost); document.getElementById("mypage1").innerHTML=' $'+total ; document.getElementById("InsertRecordGross_COGS").value=total.toFixed(2) ; } document.getElementById("InsertRecordGross_Qty_Sold").onchange=calculate; document.getElementsByName("InsertRecordMerchandise_ID_Merchandise_Cost")[0].onchange=calculate; calculate(); </SCRIPT> </span></strong> Quote Link to comment Share on other sites More sharing options...
Aurora Posted September 8, 2016 Report Share Posted September 8, 2016 Hi zalipresents, What is this? 17 hours ago, zalipresents said: ?0: 17 hours ago, zalipresents said: ("InsertRecordMerchandise_ID_Merchandise_Cost")[0] If I understand correctly, you use Cascading Field as a trigger for calculation? If yes, then I am afraid It is not possible. Perhaps, it is possible for .onsubmit action. ( Not sure). Aurora 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.