function isValidEmail(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ alert("Invalid E-mail ID") return false } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ alert("Invalid E-mail ID") return false } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ alert("Invalid E-mail ID") return false } if (str.indexOf(at,(lat+1))!=-1){ alert("Invalid E-mail ID") return false } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ alert("Invalid E-mail ID") return false } if (str.indexOf(dot,(lat+2))==-1){ alert("Invalid E-mail ID") return false } if (str.indexOf(" ")!=-1){ alert("Invalid E-mail ID") return false } return true } function IsNumeric(sText) { var ValidChars = "0123456789"; var IsNumber=true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; } function IsEmptyOption(aTextField) { if ( aTextField.selectedIndex == 0 ) { alert('Fill all required fields.'); return true; } } function IsEmpty(aTextField) { if ((aTextField.value.length==0) || (aTextField.value==null)) { alert('Fill all required fields.'); return true; } else { return false; } } function thesame(aTextField, bTextField) { if (aTextField.value==bTextField.value) { return true; } else { return false; } } function ValidateCMNAForm(form) { if(IsEmptyOption(form.group)) { alert('You have not choosen a group from frop down list') form.group.focus(); return false; } if(IsEmptyOption(form.crs)) { alert('You have not choosen a CRS from frop down list') form.crs.focus(); return false; } if(IsEmptyOption(form.timeslot)) { alert('You have not choosen a timeslot from frop down list') form.timeslot.focus(); return false; } if(IsEmpty(form.fname)) { alert('You have not entered a first name') form.fname.focus(); return false; } if(IsEmpty(form.lname)) { alert('You have not entered a last name') form.lname.focus(); return false; } if(IsEmpty(form.username)) { alert('You have not entered a username') form.username.focus(); return false; } if(IsEmpty(form.email_new)) { alert('You have not entered an Email Address') form.email_new.focus(); return false; } if(IsEmpty(form.email2_new)) { alert('You have not entered an Email Address') form.email2_new.focus(); return false; } if(!isValidEmail(form.email_new.value)) { alert('You have not entered valid email') form.email_new.focus(); return false; } if(!thesame(form.email_new, form.email2_new)) { alert('Please make sure both email addresses are the same') return false; } } function ValidateForm(form) { if(IsEmptyOption(form.group)) { alert('You have not choosen a group from frop down list') form.group.focus(); return false; } if(IsEmpty(form.fname)) { alert('You have not entered a first name') form.fname.focus(); return false; } if(IsEmpty(form.lname)) { alert('You have not entered a last name') form.lname.focus(); return false; } if(IsEmpty(form.city_new)) { alert('You have not entered a City') form.city_new.focus(); return false; } if(IsEmpty(form.state_new)) { alert('You have not entered a State') form.state_new.focus(); return false; } if(IsEmpty(form.phonenumber_new)) { alert('You have not entered a Phone Number') form.phonenumber_new.focus(); return false; } if(IsEmpty(form.email_new)) { alert('You have not entered an Email Address') form.email_new.focus(); return false; } if(IsEmpty(form.email2_new)) { alert('You have not entered an Email Address') form.email2_new.focus(); return false; } if(!isValidEmail(form.email_new.value)) { alert('You have not entered valid email') form.email_new.focus(); return false; } if(!thesame(form.email_new, form.email2_new)) { alert('Please make sure both email addresses are the same') return false; } if (!IsNumeric(form.phonenumber_new.value)) { alert('Please enter only numbers in the Primary phone number field') form.phonenumber_new.focus(); return false; } return true; } function CheckActivity(form) { if(IsEmptyOption(form.dsubmitted_m)) { alert('You have not choosen an activity month from frop down list') form.dsubmitted_m.focus(); return false; } if(IsEmptyOption(form.dsubmitted_d)) { alert('You have not choosen an activity day from frop down list') form.dsubmitted_d.focus(); return false; } if(IsEmptyOption(form.dsubmitted_y)) { alert('You have not choosen an activity year from frop down list') form.dsubmitted_y.focus(); return false; } if(IsEmptyOption(form.thours)) { alert('You have not entered number of hours') form.thours.focus(); return false; } if(IsEmpty(form.jobsites)) { alert('You have not entered number of hours for Job Sites') form.jobsites.focus(); return false; } if(IsEmpty(form.directly)) { alert('You have not entered number of hours for Directly submitted') form.directly.focus(); return false; } if(IsEmpty(form.mspartners)) { alert('You have not entered number of hours for MS/Cisco partners') form.mspartners.focus(); return false; } if(IsEmpty(form.snotes)) { alert('You have not entered a Summary') form.snotes.focus(); return false; } if ((form.agreed.checked == false) ) { alert('Please check the "I agree" checkbox to continue.'); return false; } else return true; return true; } function CheckJobResponseAdd(form) { if(IsEmptyOption(form.job_response_type_id)) { alert('You have not choosen response type from frop down list') form.job_response_type_id.focus(); return false; } if(IsEmpty(form.snotes)) { alert('You have not entered Response Summary') form.snotes.focus(); return false; } return true; }