TypeError: document.getElementById(...) は null です。フォームをクリックして続行すると、このエラーが生成されます。このエラーを修正する方法を教えてください。
続行ボタンをクリックすると、ボタン呼び出し関数送信フォーム
<script type="text/javascript">
function submitForm( )
{
var form = document.paywayForm;
var errorString = "";
var recurringURL = "https://www.payway.com.au/SignUp?ClientNumber=Q12882&&merchant_id=23660327&FirstPaymentDate=&CustomerNumber=&returnURL=&AddressRequired=true&PlanName=";
// NOTE: THIS USES A TEST MERCHANT!!
var netURL = "https://www.payway.com.au/MakePayment?BillerCode=128827&merchant_id=23660327&payment_amount=";
if( document.getElementById("RecurringRadio").checked == true )
{
if( document.getElementById("frequency1").value == null || document.getElementById("frequency1").value == "" )
{
errorString = errorString + " payment frequency";
}
if( document.getElementById("SelectAmount1").value == null || document.getElementById("SelectAmount1").value == "" )
{
errorString = errorString + " payment amount";
}
if( errorString == "" )
{
document.location = recurringURL + document.getElementById("frequency1").value + document.getElementById("SelectAmount1").value +
"&Firstname=" + document.getElementById("OneOffAmount1").value;
}
}
else if( document.getElementById("OneOffRadio").checked == true )
{
if( document.getElementById("OneOffAmount1").value == null || document.getElementById("OneOffAmount1").value == "" )
{
errorString = errorString + "payment amount ";
}
if( document.getElementById("Firstname").value == null || document.getElementById("Firstname").value == "" )
{
errorString = errorString + "name ";
}
if( document.getElementById("Surname").value == null || document.getElementById("Surname").value == "" )
{
errorString = errorString + "surname ";
}
if( document.getElementById("Address").value == null || document.getElementById("Address").value == "" )
{
errorString = errorString + "address ";
}
if( document.getElementById("Suburb").value == null || document.getElementById("Suburb").value == "" )
{
errorString = errorString + "suburb ";
}
if( document.getElementById("Postcode").value == null || document.getElementById("Postcode").value == "" )
{
errorString = errorString + "postcode ";
}
if( errorString == "" )
{
var newredirect = netURL + document.getElementById("OneOffAmount1").value +
"&information_fields=Direct_Funds,Title,Firstname,Surname,Address,Suburb,Postcode,State,Country,Phone,Mobile,Email,Bmail,PAWS&payment_reference=00041234" +
"&Direct_Funds=" + document.getElementById("Direct_Funds").value +
"&Title=" + document.getElementById("Title").value +
"&Firstname=" + document.getElementById("Firstname").value +
"&Surname=" + document.getElementById("Surname").value +
"&Address=" + document.getElementById("Address").value +
"&Suburb=" + document.getElementById("Suburb").value +
"&Postcode=" + document.getElementById("Postcode").value +
"&State=" + document.getElementById("State").value +
"&Country=" + document.getElementById("Country").value +
"&Phone=" + document.getElementById("Phone").value +
"&Mobile=" + document.getElementById("Mobile").value +
"&Email=" + document.getElementById("Email").value +
"&Bmail=" + document.getElementById("Bmail").value +
"&PAWS=" + document.getElementById("PAWS").value;
// alert(newredirect);
document.paywayForm.submit();
/* document.location.href = newredirect;*/
}
}
else
{
errorString = errorString + "You must select a donation type<br/>";
}
if( errorString != "" )
{
//alert(errorString);
var errorEl = document.getElementById("Error");
errorEl.innerHTML = "<b>The following fields must be completed: </b><br/> " + errorString + "";
//alert(errorEl.innerHTML);
}
}
</script>