function validateForm (theForm) { // Create an empty string to hold the error messages. errorString = ''; // Each time there's an error, add an error message if(IsEmpty(theForm.first_name)) { errorString += '
  • Please provide your first name.
  • '; theForm.first_name.style.border="1px solid red"; } else theForm.first_name.style.border=""; if(IsEmpty(theForm.last_name)) { errorString += '
  • Please provide your last name.
  • '; theForm.last_name.style.border="1px solid red"; } else theForm.last_name.style.border=""; if(! validEmail(theForm.email.value)) { errorString += '
  • Please provide a valid email address.
  • '; theForm.email.style.border="1px solid red"; } else theForm.email.style.border=""; if(IsEmpty(theForm.phone)) { errorString += '
  • Please provide your phone number.
  • '; theForm.phone.style.border="1px solid red"; } else theForm.phone.style.border=""; if(IsEmpty(theForm.address)) { errorString += '
  • Please provide your address.
  • '; theForm.address.style.border="1px solid red"; } else theForm.address.style.border=""; if(IsEmpty(theForm.present_institution)) { errorString += '
  • Please provide your present institution.
  • '; theForm.present_institution.style.border="1px solid red"; } else theForm.present_institution.style.border=""; if(IsEmpty(theForm.phd_institution)) { errorString += '
  • Please provide your Ph.D. institution.
  • '; theForm.phd_institution.style.border="1px solid red"; } else theForm.phd_institution.style.border=""; //Check document collection for ( var i=0; i< theForm.elements['documents[]'].length; i++ ) { label = document.getElementById('documents_label_' + i); if ( IsEmpty(theForm.elements['documents[]'][i]) ) { label.style.color="red"; errorString += "
  • A required document attachment is missing.
  • "; } else label.style.color=""; } //Check publication collection var required = 0; var notEmpty = 0; pubColl = document.getElementsByName('publication_files[]'); for ( var i=0; i< pubColl.length; i++ ) { if ( ! IsEmpty( pubColl[i] ) ) notEmpty++; } if ( notEmpty < required ) errorString += "
  • At least " + required + " publications are required.
  • "; //Check referee collection var required = 3; var notEmpty = 0; refColl = document.getElementsByName('referee[name][]'); for ( var i=0; i< refColl.length; i++ ) { if ( ! IsEmpty( refColl[i] ) ) notEmpty++; } if ( notEmpty < required ) errorString += "
  • At least " + required + " referee is required.
  • "; // If the error string is empty, there were no errors. if ( errorString == '') { // Form processing theForm.flag.value = "true"; return true; } else { // The error string had something in it errorString = "

    Please check the following and try again:

    "; oFormError = document.getElementById("form_error"); oFormError.innerHTML = errorString; oFormError.style.display = "block"; window.scrollTo(0,0); theForm.flag.value= "false"; return false; } }