I can't get concatenation to work on multiple phone numbers on one form - I can only get one group of 4 groups of concatenated phone numbers to work at a time. When I label "var allpositions" with separate numbers (1, 2, 3, 4) only the last one works. When I remove the numbers from the "var allpositions" so they're all labeled the same, then only the first one works. The inserted punctuation (where I've inserted parentheses and spaces into the resultant phone number) do work on in the concatenated field (PH_1, 2, 3 and 4) but it's not pulling in the data from the fields.
function concatenate()
{
var position1 = document.getElementById("InsertRecordPhone1_ID").value;
var position2 = document.getElementById("InsertRecordPhone1_AC").value;
var position3 = document.getElementById("InsertRecordPhone1").value;
var allpositions1 = position1 + " " + "(" + position2 + ")" + " " + position3;
document.getElementById("InsertRecordPH_1").value = allpositions1;
}
function concatenate()
{
var position4 = document.getElementById("InsertRecordPhone2_ID").value;
var position5 = document.getElementById("InsertRecordPhone2_AC").value;
var position6 = document.getElementById("InsertRecordPhone2").value;
var position7 = document.getElementById("InsertRecordPh2Ext").value;
var allpositions2 = position4 + " " + "(" + position5 + ")" + " " + position6 + " " + position7;
document.getElementById("InsertRecordPH_2").value = allpositions2;
}
function concatenate()
{
var position8 = document.getElementById("InsertRecordPhone3_ID").value;
var position9 = document.getElementById("InsertRecordPhone3_AC").value;
var position10 = document.getElementById("InsertRecordPhone3").value;
var position11 = document.getElementById("InsertRecordPh3Ext").value;
var allpositions3 = position8 + " " + "(" + position9 + ")" + " " + position10 + " " + position11;
document.getElementById("InsertRecordPH_3").value = allpositions3;
}
function concatenate()
{
var position12 = document.getElementById("InsertRecordPhone4_ID").value;
var position13 = document.getElementById("InsertRecordPhone4_AC").value;
var position14 = document.getElementById("InsertRecordPhone4").value;
var position15 = document.getElementById("InsertRecordPh4Ext").value;
var allpositions4 = position12 + " " + "(" + position13 + ")" + " " + position14 + " " + position15;
document.getElementById("InsertRecordPH_4").value = allpositions4;
}
document.getElementById("caspioform").onsubmit=concatenate;