Jump to content

Java Concatenate - Ignore certain fields


Recommended Posts

My script is below and works great. I am wondering is there a way to add a Virtual Field Checkbox, and if it is checked, for the code to ignore variables x1, x2, x3, x4, x5, x6, x7, x8, x9, and x10? Basically if the box is checked, fields x1 thru x10 would not be added to emailstosend.

I tried doing it through a rule, to disable the cbParamVirtual fields, but that did not work, it still added them in.

Let me know if anyone has a solution.

Thanks!
Mark

 

<SCRIPT LANGUAGE="JavaScript">
function concatenate() 

var x1 = document.getElementsByName("cbParamVirtual6")[0].value; 
var x2 = document.getElementsByName("cbParamVirtual7")[0].value;
var x3 = document.getElementsByName("cbParamVirtual8")[0].value;
var x4 = document.getElementsByName("cbParamVirtual9")[0].value;
var x5 = document.getElementsByName("cbParamVirtual10")[0].value;
var x6 = document.getElementsByName("cbParamVirtual16")[0].value; 
var x7 = document.getElementsByName("cbParamVirtual17")[0].value;
var x8 = document.getElementsByName("cbParamVirtual18")[0].value;
var x9 = document.getElementsByName("cbParamVirtual19")[0].value;
var x10 = document.getElementsByName("cbParamVirtual20")[0].value;
var x11 = document.getElementsByName("cbParamVirtual21")[0].value; 
var x12 = document.getElementsByName("cbParamVirtual22")[0].value;
var x13 = document.getElementsByName("cbParamVirtual23")[0].value;
var x14 = document.getElementsByName("cbParamVirtual24")[0].value;
var x15 = document.getElementsByName("cbParamVirtual25")[0].value;
var x16 = document.getElementsByName("cbParamVirtual26")[0].value; 
var x17 = document.getElementsByName("cbParamVirtual27")[0].value;
var x18 = document.getElementsByName("cbParamVirtual28")[0].value;
var x19 = document.getElementsByName("cbParamVirtual29")[0].value;
var x20 = document.getElementsByName("cbParamVirtual30")[0].value;

document.getElementById("InsertRecordemailstosend").value = x1+" "+x2+" "+x3+" "+x4+" "+x5+" "+x6+" "+x7+" "+x8+" "+x9+" "+x10+" "+x11+" "+x12+" "+x13+" "+x14+" "+x15+" "+x16+" "+x17+" "+x18+" "+x19+" "+x20; 

document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT>

 

 

Link to comment
Share on other sites

Try adding a condition before concatenation. Use my code instead of this part:

document.getElementById("InsertRecordemailstosend").value = x1+" "+x2+" "+x3+" "+x4+" "+x5+" "+x6+" "+x7+" "+x8+" "+x9+" "+x10+" "+x11+" "+x12+" "+x13+" "+x14+" "+x15+" "+x16+" "+x17+" "+x18+" "+x19+" "+x20; 

 

if (document.getElementById("cbParamVirtual1").checked==true)
{
document.getElementById("InsertRecordemailstosend").value = x1+" "+x2+" "+x3+" "+x4+" "+x5+" "+x6+" "+x7+" "+x8+" "+x9+" "+x10+" "+x11+" "+x12+" "+x13+" "+x14+" "+x15+" "+x16+" "+x17+" "+x18+" "+x19+" "+x20; 
}
else{
document.getElementById("InsertRecordemailstosend").value = x12+" "+x13+" "+x14+" "+x15+" "+x16+" "+x17+" "+x18+" "+x19+" "+x20; 
}
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...
×
×
  • Create New...