Bangalore Posted October 17, 2014 Report Share Posted October 17, 2014 How can I copy value entered in one field to another field in a Submission Form? Quote Link to comment Share on other sites More sharing options...
GoCubbies Posted October 17, 2014 Report Share Posted October 17, 2014 You could try something like this: <SCRIPT LANGUAGE="JavaScript"> function copy() { /*Store Field 1 in variable v_Field1*/ var v_Field1 = parseFloat(document.getElementById("InsertRecordField1").value); /*Insert value of v_FIeld1 into Field2*/ document.getElementById("InsertRecordField2").value = v_Field1; } /* On submitting the webform, the function copy is executed */ document.getElementById("caspioform").onsubmit=copy;</SCRIPT> Quote Link to comment Share on other sites More sharing options...
Bangalore Posted October 17, 2014 Author Report Share Posted October 17, 2014 Thanks, To copy the value from the text field, I removed the parseFloat part of the code. Quote Link to comment Share on other sites More sharing options...
JayMont Posted June 9, 2016 Report Share Posted June 9, 2016 You could also try something like this: document.onsubmit = function(){ document.getElementById("InsertRecordFieldName1").value = document.getElementById("InsertRecordFieldName2").value; } You can also create conditions, such as checking if the other field is blank before copying the value: document.onsubmit = function(){ if(document.getElementById("InsertRecordFieldName1").value == ""){ document.getElementById("InsertRecordFieldName1").value = document.getElementById("InsertRecordFieldName2").value; } } Quote Link to comment Share on other sites More sharing options...
Kurumi Posted July 22, 2019 Report Share Posted July 22, 2019 Hi @Bangalore, Just an update: You can also use the Calculated Values without using JS. Calculated Value form element generates dynamic calculations that automatically update as users interact with your form. Similar to Formula Fields and Calculated Fields, you can construct the calculation using functions, logic, constants, values from other fields and SQL expressions. For more information about Calculated Values, check this article: https://howto.caspio.com/datapages/datapage-components/calculated-values/ Hope it 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.