JS Validation
Posted: Fri Apr 10, 2009 8:53 am
I can't get my validation to work for radio buttons!
I'm trying to use it like a checkbox, but it won't work.
I'm trying the getElementByID, but it won't work.
Please help
I'm trying to use it like a checkbox, but it won't work.
I'm trying the getElementByID, but it won't work.
Please help
Code: Select all
<SCRIPT type=text/javascript>
function validateForm() {
var errors='';
if(document.application.firstname.value == "")errors+='First Name.\n'
if(document.application.lastname.value == "")errors+='Last Name.\n'
if(document.application.address.value == "")errors+='Street Address.\n'
if(document.application.city.value == "")errors+='City.\n'
if(document.application.state.value == "")errors+='State.\n'
if(document.application.zip.value == "")errors+='Zip.\n'
if(document.application.phone.value == "")errors+='Phone.\n'
if(document.application.email.value == "")errors+='Email.\n'
if(document.application.age.value == "")errors+='Age.\n'
if(document.getElementById("adoptaddress").value == "")errors+='If your residence will be the cats new home.\n'
if(document.application.firstcat.checked == false)errors+='If this is your first cat.\n'
if(document.application.allergy.checked == false)errors+='If anyone in your household has an allergy to cats.\n'
if(document.application.numberofadults.value == "")errors+='Number of Adults.\n'
if(document.application.household.checked == false)errors+='What kind of household the cat will be living in.\n'
if(document.application.living.checked == false)errors+='What kind of home the cat will be living in.\n'
if(document.application.rent_own.checked == false)errors+='If you rent or own.\n'
if(document.application.declaw.checked == false)errors+='If you plan on declawing the cat.\n'
if(document.application.heartcheck.checked == false)errors+='If HEART can check the place of residence.\n'
if(document.application.responsible.checked == false)errors+='If you will take responsibility for this cat.\n'
if(document.application.certify.checked == false)errors+='Please check the box that you certify this information is true.\n'
if (errors) alert('The following required fields were left blank:\n'+errors);
document.returnValue = (errors == ''); }
</SCRIPT>