Jump to content

Copy Value Of One Field To Another Field In A Submission Form?


Recommended Posts

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>

Link to comment
Share on other sites

  • 1 year later...

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;
     }
}

 

Link to comment
Share on other sites

  • 3 years later...

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!

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...