Subject: RE: Concatenate Numbers like Text in Javascript
Acutally I am using eval() becuase I have 1 set of input fields and 12 value holder fields. I am using the eval() function and passing it the place holder number.
Here is my function:
function transfer(what)
{
cat = document.forms[0].RET1_A.value + “-” + document.forms[0].RET2_A.value + “-” + document.forms[0].RET3_A.value ;
eval(‘document.forms[0].FName_A_’+what+‘.value=document.forms[0].FName_A.value’);
eval(‘document.forms[0].MIntial_A_’+what+‘.value=document.forms[0].MIntial_A.value’);
eval(‘document.forms[0].LName_A_’+what+‘.value=document.forms[0].LName_A.value’);
eval(‘document.forms[0].Email_A_’+what+‘.value=document.forms[0].Email_A.value’);
eval(‘document.forms[0].EmailC_A_’+what+‘.value=document.forms[0].EmailC_A.value’);
eval(‘document.forms[0].DOB1_A_’+what+‘.value=document.forms[0].DOB1_A.value’);
eval(‘document.forms[0].DOB2_A_’+what+‘.value=document.forms[0].DOB2_A.value’);
eval(‘document.forms[0].DOB3_A_’+what+‘.value=document.forms[0].DOB3_A.value’);
eval(‘document.forms[0].Relationship_A_’+what+‘.value=document.forms[0].Relationship_A.value’);
eval(‘document.forms[0].TempAddress_A_’+what+‘.value=document.forms[0].TempAddress_A.value’);
eval(‘document.forms[0].TempFName_A_’+what+‘.value=document.forms[0].TempFName_A.value’);
eval(‘document.forms[0].TempMIntial_A_’+what+‘.value=document.forms[0].TempMIntial_A.value’);
eval(‘document.forms[0].TempLName_A_’+what+‘.value=document.forms[0].TempLName_A.value’);
eval(‘document.forms[0].TempAddress1_A_’+what+‘.value=document.forms[0].TempAddress1_A.value’);
eval(‘document.forms[0].TempAddress2_A_’+what+‘.value=document.forms[0].TempAddress2_A.value’);
eval(‘document.forms[0].TempCity_A_’+what+‘.value=document.forms[0].TempCity_A.value’);
eval(‘document.forms[0].TempState_A_’+what+‘.value=document.forms[0].TempState_A.value’);
eval(‘document.forms[0].TempZip_A_’+what+‘.value=document.forms[0].TempZip_A.value’);
eval(‘document.forms[0].TempZipFour_A_’+what+‘.value=document.forms[0].TempZipFour_A.value’);
eval(‘document.forms[0].TempPhone1_A_’+what+‘.value=document.forms[0].TempPhone1_A.value’);
eval(‘document.forms[0].TempPhone2_A_’+what+‘.value=document.forms[0].TempPhone2_A.value’);
eval(‘document.forms[0].TempPhone3_A_’+what+‘.value=document.forms[0].TempPhone3_A.value’);
eval(‘document.forms[0].TempReturnDate_A_’+what+‘.value=’ + cat);
eval(‘document.forms[0].TempCorrespondence_A_’+what+‘.value=document.forms[0].TempCorrespondence_A.value’);
I then want to take the three text input date fields and put them together into one text place holder date field. I would like to use the “-” as separate becuase later I may have to recall the field values and would like to use the split() function to parse them back using the “-” rather then worrying about place holders, etc.
Is there a way around the eval() function reading my value as a math bur rather as text?