有些表格不接受JS函数的值。
我已经创建了一种填充所有字段的方法,当我单击“继续”按钮时,所有填充的信息都消失了,并且先前填充的每个字段上的错误都显示“请输入*值”。
有人可以帮我吗?
这是我需要填写的表格的示例链接和代码:
https://applynow.capitalone.com/?productId=3429
function capitalone(){
var data = {"firstName":"john","middleName":"","lastName":"smith","uSuffix":"","address":"5201 Great America Pakwy","address2":"","unit":"5201","city":"Santa Clara","state":"CA","zip":"95054","housing":"","Mortage":"","annual":"","position":"","employer":"","phone":"","email":"","DOB":"","securityNumber":"","motherMaidenName":"","account":"","amount":"","PAN":"","amexCardNo1a":"","amexCardNo1b":"","amexCardNo1c":"","phonePincode":"","compAddr1":"","employmentStatus":"","businessName":"hello","nameOnCard":"hello","legalStructure":"hello","TIN":"219312031","Ownership":"Publicly Traded","industryType":"Agriculture, Forestry, Fishing and Hunting","subcategory":"Forestry and Logging","industrySpeciality":"Logging","revenue":"100000","spendPerMonth":"1000"};
setTimeout(function(){
document.getElementById('legalBusinessName').focus()
},500)
setTimeout(function(){
$('#legalBusinessName')[0].value = data.businessName
},1000)
setTimeout(function(){
document.getElementById('businessNameOnCard').focus()
},1500)
setTimeout(function(){
$('#businessNameOnCard')[0].value = data.nameOnCard
},2000)
setTimeout(function(){
document.getElementById('combinedBusinessStreetAddress').focus()
},2500)
setTimeout(function(){
$('#combinedBusinessStreetAddress')[0].value = data.address
},3000)
setTimeout(function(){
document.getElementById('businessPhoneNumber').focus()
},3500)
setTimeout(function(){
$('#businessPhoneNumber')[0].value = data.phoneNumber
},4000)
setTimeout(function(){
document.querySelector('#businessLegalStructure_input .rw-dropdown-list-input').focus()
},4500)
setTimeout(function(){
$('#businessLegalStructure_input .rw-dropdown-list-input')[0].value = data.legalStructure
},5000)
setTimeout(function(){
document.getElementById('businessTIN').focus()
},5500)
setTimeout(function(){
$('#businessTIN')[0].value = data.TIN
},6000)
setTimeout(function(){
document.querySelector('#businessOwnershipType_input .rw-dropdown-list-input').focus()
},6500)
setTimeout(function(){
$('#businessOwnershipType_input .rw-dropdown-list-input')[0].value = data.Ownership
},7000)
setTimeout(function(){
document.getElementById('industryTypeMain').focus()
},7500)
setTimeout(function(){
$('#industryTypeMain')[0].value = data.industryType
},8000)
setTimeout(function(){
document.getElementById('industryTypeSubCategory').focus()
},8500)
setTimeout(function(){
$('#industryTypeSubCategory')[0].value = data.subcategory
},9000)
setTimeout(function(){
document.getElementById('industryTypeSpecialty').focus()
},9500)
setTimeout(function(){
$('#industryTypeSpecialty')[0].value = data.industrySpeciality
},10000)
setTimeout(function(){
document.getElementById('businessRevenue').focus()
},10500)
setTimeout(function(){
$('#businessRevenue')[0].value = data.revenue
},11000)
setTimeout(function(){
document.getElementById('businessSpend').focus()
},11500)
setTimeout(function(){
$('#businessSpend')[0].value = data.spendPerMonth
},12000)
setTimeout(function(){
document.getElementById('firstName').focus()
},12500)
setTimeout(function(){
$('#firstName')[0].value = data.firstName;
},13000)
if(data.middleName && data.middleName != "")
{
setTimeout(function(){
document.getElementById('middleInitial').focus()
},13500)
setTimeout(function(){
$('#middleInitial')[0].value = data.middleName;
},14000)
}
setTimeout(function(){
document.getElementById('lastName').focus()
},14500)
setTimeout(function(){
$('#lastName')[0].value = data.lastName;
},15000)
setTimeout(function(){
document.getElementById('dateOfBirth').focus()
},15500)
setTimeout(function(){
$('#dateOfBirth')[0].value = data.DOB;
},16000)
setTimeout(function(){
document.getElementById('socialSecurityNumber').focus();
},16500);
setTimeout(function(){
$('#socialSecurityNumber')[0].value = data.securityNumber;
},17000)
/*
if(data.citizenship && data.citizenship != ""){
if (data.citizenship == "Yes")
$('#citizenYes').click();
else
$('citizenNo').click();
}
if (data.otherCitizenship && data.otherCitizenship != ""){
if (data.otherCitizenship == "Yes"){
$('dualCitizenYes').click();
}
else{
$('dualCitizenNo').click();
}
}
*/
setTimeout(function(){
document.getElementById('combinedStreetAddress').focus()
},17500)
setTimeout(function(){
$('#combinedStreetAddress')[0].value = data.address;
},18000)
setTimeout(function(){
document.getElementById('email').focus()
},18500)
setTimeout(function(){
$('#email')[0].value = data.email;
},19000)
setTimeout(function(){
document.getElementById('phoneNumber').focus()
},19500)
setTimeout(function(){
$('#phoneNumber')[0].value = data.phone;
},20000)
setTimeout(function(){
document.querySelector('#checkingOrSavings_input .rw-dropdown-list-input').focus()
},20500)
setTimeout(function(){
document.querySelectorAll('#checkingOrSavings_input .rw-dropdown-list-input')[0].textContent = "Neither"
},21000)
setTimeout(function(){
document.querySelector('#employmentStatus_input .rw-dropdown-list-input').focus()
},21500)
setTimeout(function(){
document.querySelectorAll('#employmentStatus_input .rw-dropdown-list-input')[0].textContent = "Employed"
},22000)
if(data.Employed == "Employed")
{
setTimeout(function(){
document.getElementById('occupation').focus()
},22500)
setTimeout(function(){
$('#occupation')[0].value = data.occupation;
},23000)
}
setTimeout(function(){
document.getElementById('annualIncome').focus()
},23500)
setTimeout(function(){
$('#annualIncome')[0].value = data.annual;
},24000)
setTimeout(function(){
document.getElementById('monthlyRentMortgage').focus();
},24500)
setTimeout(function(){
$('#monthlyRentMortgage')[0].value = data.Mortage;
},25000)
}