Jump to content

Single Rec Update Mutli-Select Form Virtual Fields to Table using JavaScript

Recommended Posts


I've reviewed the forums and have been able to successfully pass virtual field data into my Caspio tables using the '"Cascading drop-downs" JavaScript code method in the header and footer section of the form. It's working perfectly. 


I'm currently having an issue passing virtual field data into my Caspio table using a "Single Record" update form; which is required for my multi-step submission form . I modified the code for 'text field' (removing the [0]) since cascading drop-downs are not being used.  The user will be entering data into the form directly. 


The code I'm using  to 'get' the virtual text field value in the Header section of the single record update form is:


function concatenate()
var x = document.getElementsByName("cbParamVirtual1").value;
document.getElementById("LandFillRate1_Field").value = x;

var x = document.getElementsByName("cbParamVirtual2").value;
document.getElementById("LandFillRate2_Field").value = x;

var x = document.getElementsByName("cbParamVirtual3").value;
document.getElementById("LandFillRate3_Field").value = x;

var x = document.getElementsByName("cbParamVirtual4").value;
document.getElementById("LandFillRate4_Field").value = x;

var x = document.getElementsByName("cbParamVirtual5").value;
document.getElementById("LandFillRate5_Field").value = x;


The code I'm using to insertrecord into the table in the Footer Section of the single record update form is as follows: 

function concatenate()
var x = document.getElementById("cbParamVirtual1").value;
document.getElementById("InsertRecordLandFillRate1").value = x;

var x = document.getElementById("cbParamVirtual2").value;
document.getElementById("InsertRecordLandFillRate2").value = x;

var x = document.getElementById("cbParamVirtual3").value;
document.getElementById("InsertRecordLandFillRate3").value = x;

var x = document.getElementById("cbParamVirtual4").value;
document.getElementById("InsertRecordLandFillRate4").value = x;

var x = document.getElementById("cbParamVirtual5").value;
document.getElementById("InsertRecordLandFillRate5").value = x;



Unsure if my getElement should be by Name or ID; and if it differs between the header and footer scripts. The examples for the footer script show ID and the header shows name. I'm officially confused. I'd greatly appreciate any assistance provided. I checked the script using the F12 function  in the console and everything looks good but still no data showing in the table. 




Link to comment
Share on other sites

  • 2 months later...

If you want to refer to an element by ID the correct format is:


document.getElementsByName("ID OF THE ELEMENT")[0].value


To see if you need to use ID or Name, open your page in browser and right click on it, select Inspect Element and see if the ID has some extra numbers after it, if it does then you need to get the name.

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.

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.

  • Create New...