braxwell Posted September 23, 2020 Report Share Posted September 23, 2020 Hello all, Im using the following code to combine the values of several fields to create a parent value for a cascading element. My problem is the cascading elect won't update unless I actually type in the parent field - how can I force the cascade to update? <script> document.getElementsByName("InsertRecordFrame_Desc")[0].onchange = function () {{ var box80 = document.getElementsByName("InsertRecordFrame_Collection")[0]; var box81 = document.getElementsByName("InsertRecordLens_Package")[0]; var box82 = document.getElementsByName("InsertRecordInsuranceLevel")[0]; var box83 = document.getElementsByName("InsertRecordInsuranceDet")[0]; box83.value = box82.value + box80.value + box81.value; }} </script> Quote Link to comment Share on other sites More sharing options...
Nuke354 Posted September 23, 2020 Report Share Posted September 23, 2020 Hi @braxwell You can try using this example:https://c0dcd456.caspio.com/dp/ad9b7000f144a76884d34da090ed Virtual4 is dependent on Virtual3. Type in Apple + Pie separately on Virtual1 and Virtual2 <script> document.getElementsByClassName("cbFormTextField")[0].addEventListener("change", function(){ var v1 = document.getElementsByName("cbParamVirtual1")[0]; var v2 = document.getElementsByName("cbParamVirtual2")[0]; var v3 = document.getElementsByName("cbParamVirtual3")[0]; v3.value = v1.value + v2.value; var event = new Event('change'); v3.dispatchEvent(event); }) </script> I have used var event = new Event('change'); v3.dispatchEvent(event); to trigger a change to make the cascade update. You may modify it to fit your needs. 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.