// here will go our js content parsed from php compiler // alert("I am from common.php"); TODO digit and username exist validation function isValidEmail(email_address) { //Assumes that valid email addresses consist of user_name@domain.tld at = email_address.indexOf('@'); dot = email_address.lastIndexOf('.'); //email_address.IndexOf('.'); if(at == -1 || dot == -1 || dot <= at + 1 || dot == 0 || dot == email_address.length - 1) return(false); user_name = email_address.substr(0, at); domain_name = email_address.substr(at + 1, email_address.length); if(Validate_String(user_name) === false || Validate_String(domain_name) === false) return(false); return(true); } function validate_registration(){ // validation for registration page will go here .. var frmRegister = document.frm_register; var errorHeadString = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n"; var flag = false; var visitor = ""; // verify MemberType if( frmRegister.memberType ) { if( !frmRegister.memberType[0].checked && !frmRegister.memberType[1].checked ) { visitor += "\n- Register as not selected."; } } //end country validation // validate emailAddress if( frmRegister.emailAddress ) { if( ( frmRegister.emailAddress.value ) == '' ) { visitor += "\n- Email address is blank."; }else if( !isValidEmail(frmRegister.emailAddress.value) ) { visitor += "\n- Invalid email address."; } } // end email validation if(frmRegister.register && frmRegister.register.value =='register') { if( frmRegister.password && frmRegister.repassword) { var password = (frmRegister.password.value); var repass = (frmRegister.repassword.value); if( password == '' ) { visitor += "\n- Password is blank."; } else { // check reentred pass is matching or not .. if( password == repass ) { // success }else { visitor += "\n- Password is not matching.."; } } } // end password validation } if( frmRegister.title ) { if( ( frmRegister.title.value ) == '' ) { visitor += "\n- Title not selected."; } } //end country validation if( frmRegister.position ) { if( ( frmRegister.position.value ) == '' ) { visitor += "\n- Position is blank."; } } if( frmRegister.fullName ) { if( ( frmRegister.fullName.value ) == '' ) { visitor += "\n- Full name is blank."; } } if( frmRegister.fullName ) { if( ( frmRegister.profileName.value ) == '' ) { visitor += "\n- Name of Doctor/Hospital is blank."; } } if( frmRegister.streetAddress ) { if( ( frmRegister.streetAddress.value ) == '' ) { visitor += "\n- Address is blank."; } } if( frmRegister.city ) { if( ( frmRegister.city.value ) == '' ) { visitor += "\n- City is blank."; } } if( frmRegister.state ) { if( ( frmRegister.state.value ) == '' ) { visitor += "\n- State is blank."; } } if( frmRegister.zip ) { if( ( frmRegister.zip.value ) == '' ) { visitor += "\n- Zip/Postal code is blank."; } } if( frmRegister.country ) { if( ( frmRegister.country.value ) == '' ) { visitor += "\n- Country not selected."; } } //end country validation if( frmRegister.contactPhone ) { if( ( frmRegister.contactPhone.value ) == '' ) { visitor += "\n- Phone no is blank."; } }// end phone no validation if( frmRegister.captcha ) { if( ( frmRegister.captcha.value ) == '' ) { visitor += "\n- Please enter image verification code."; } } if( frmRegister.agree_terms ) { if( frmRegister.agree_terms.checked == false ) { visitor += "\n- Terms & conditions not accepted."; } } if(visitor != "") { errorHeadString = errorHeadString + visitor; flag=true; } if (flag == true) { alert(errorHeadString); return false; }else { return true; // validation success } } // function validate_registration closed /********************************************************************************************************************/ function validate_hospital_info(){ // Validating providers hospital info var frmHosp = document.frm_hospital; var errorHeadString = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n"; var flag = false; var visitor = ""; if( frmHosp.hospital_name ) { if( ( frmHosp.hospital_name.value ) == '' ) { visitor += "\n- Hospital/Clinic name is blank."; } } if( frmHosp.year_of_experience ) { if( ( frmHosp.year_of_experience.value ) == '' ) { visitor += "\n- Years of experience is blank."; } } if( frmHosp.short_description ) { if( ( frmHosp.short_description.value ) == '' ) { visitor += "\n- Short description is blank."; } else if( frmHosp.short_description.value.length > '250' ) { visitor += "\n- Short description is exceding its maximum character limit."; } } if( frmHosp.hospital_type ) { if( frmHosp.hospital_type[0].checked ==false && frmHosp.hospital_type[1].checked ==false && frmHosp.hospital_type[2].checked ==false ) { visitor += "\n- Hospital/Clinic type not selected."; } } if( frmHosp.treatmentAreaID ) { if( ( frmHosp.treatmentAreaID.value ) == '' ) { visitor += "\n- Specialty not selected."; } } if(visitor != "") { errorHeadString = errorHeadString + visitor; flag=true; } if (flag == true) { alert(errorHeadString); return false; }else { return true; // validation success } } // function validate_hospital_info clsed /********************************************************************************************************************/ function validate_billing_info(){ // Validating providers billing info var frmBill = document.frm_billing; var errorHeadString = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n"; var flag = false; var visitor = ""; if( frmBill.bill_streetAddress ) { if( ( frmBill.bill_streetAddress.value ) == '' ) { visitor += "\n- Billing address is blank."; } } if( frmBill.bill_city ) { if( ( frmBill.bill_city.value ) == '' ) { visitor += "\n- Billing city is blank."; } } if( frmBill.bill_state ) { if( ( frmBill.bill_state.value ) == '' ) { visitor += "\n- Billing state is blank."; } } if( frmBill.bill_zip ) { if( ( frmBill.bill_zip.value ) == '' ) { visitor += "\n- Billing zip/postal code is blank."; } } if( frmBill.bill_country ) { if( ( frmBill.bill_country.value ) == '' ) { visitor += "\n- Billing country not selected."; } } if(visitor != "") { errorHeadString = errorHeadString + visitor; flag=true; } if (flag == true) { alert(errorHeadString); return false; }else { return true; // validation success } } // function validate_billing_info closed function validate_bef_aft_photo(){ // Validating providers billing info var frmPhoto = document.frm_photo; var errorHeadString = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n"; var flag = false; var visitor = ""; if( frmPhoto.treatmentAreaID ) { if( frmPhoto.treatmentAreaID.value == '' ) { visitor += "\n- Please select treatment area."; } } if( frmPhoto.treatmentID ) { if( frmPhoto.treatmentID.value == '' ) { visitor += "\n- Please select treatment."; } } if(frmPhoto.action.value !='update') { if( frmPhoto.before_photo ) { if(frmPhoto.before_photo.value == '' ) { visitor += "\n- Before photo field is blank."; } } if( frmPhoto.after_photo ) { if( frmPhoto.after_photo.value == '' ) { visitor += "\n- After photo field is blank."; } } } if( frmPhoto.description ) { if( ( frmPhoto.description.value ) == '' ) { visitor += "\n- Description is blank."; } else if(frmPhoto.description.value.length>251 ) { visitor += "\n- Description character limit is exceeding maximum character limit."; } } if(visitor != "") { errorHeadString = errorHeadString + visitor; flag=true; } if (flag == true) { alert(errorHeadString); return false; }else { document.getElementById('div_load').style.display=''; return true; // validation success } } // function validate_bef_aft_photo closed /********************************************************************************************************************/ /********************************************************************************************************************/ function validate_patientReg(){ // validation for patient registration page will go here .. var frmRegister = document.frm_contact; var errorHeadString = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n"; var flag = false; var visitor = ""; if( frmRegister.email_verified ) { if( ( frmRegister.email_verified.value ) == 0 ) { visitor += "\n- Your email address has not been confirmed. If you do not receive an email please check your junk mail folder. Email confirmation is mandatory in order to contact healthcare provider."; } } if( frmRegister.fullName ) { if( ( frmRegister.fullName.value ) == '' ) { visitor += "\n- Full name is blank."; } } if( frmRegister.contactPhone ) { if( ( frmRegister.contactPhone.value ) == '' ) { visitor += "\n- Phone no is blank."; } }// end phone no validation if( frmRegister.city ) { if( ( frmRegister.city.value ) == '' ) { visitor += "\n- City is blank."; } } if( frmRegister.country ) { if( ( frmRegister.country.value ) == '' ) { visitor += "\n- Country not selected."; } } //end country validation if( frmRegister.travelMonth ) { if( ( frmRegister.travelMonth.value ) == '' ) { visitor += "\n- When do you want to travel is blank."; } } //checking that at least one checkbox should be checked if(frmRegister.opr) { var F = document.frm_contact; var i=1; var j=0; var y=0; for(i=1;i<=F.elements.length-3;i++){ if(F.elements[i].type=='checkbox' && F.elements[i].checked==true) y++; } if(y<=0) visitor += "\n- Select at least one treatment."; } if( frmRegister.description ) { if( ( frmRegister.description.value ) == '' ) { visitor += "\n- Describe the treatment you need is blank."; } } // validate emailAddress if( frmRegister.emailAddress ) { if( ( frmRegister.emailAddress.value ) == '' ) { visitor += "\n- Email address is blank."; }else if( !isValidEmail(frmRegister.emailAddress.value) ) { visitor += "\n- Invalid email address."; } } // end email validation if( frmRegister.password && frmRegister.repassword) { var password = (frmRegister.password.value); var repass = (frmRegister.repassword.value); if( password == '' ) { visitor += "\n- Password is blank."; } else { // check reentred pass is matching or not .. if( password == repass ) { // success }else { visitor += "\n- Password is not matching.."; } } } // end password validation if( frmRegister.captcha ) { if( ( frmRegister.captcha.value ) == '' ) { visitor += "\n- Please enter image verification code."; } } if( frmRegister.agree_terms ) { if( frmRegister.agree_terms.checked == false ) { visitor += "\n- Terms & conditions not accepted."; } } if(visitor != "") { errorHeadString = errorHeadString + visitor; flag=true; } if (flag == true) { alert(errorHeadString); return false; }else { return true; // validation success } } // function validate_patientReg closed // validation add-link.php for exchange link page function validateForm() { // validate emailAddress var F = document.frmAddlink; var errorHeadString = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n"; var flag = false; var visitor = ""; if( F.linkEmail ) { if( Trim( F.linkEmail.value ) == '' ) { visitor += "\n- Email address is blank."; }else if( !isValidEmail(F.linkEmail.value) ) { visitor += "\n- Invalid email address."; } } // end email validation if( F.linkReciprocal ) { if( Trim( F.linkReciprocal.value ) == '' || Trim( F.linkReciprocal.value ) == 'http://') { visitor += "\n- Reciprocal link is blank."; } else if( !isValidURL(F.linkReciprocal.value) ) { visitor += "\n- Invalid URL in reciprocal link."; } } if( F.linkTitle ) { if( Trim( F.linkTitle.value ) == '' ) { visitor += "\n- Website title is blank."; } } if( F.linkUrl ) { if( Trim( F.linkUrl.value ) == '' || Trim( F.linkUrl.value ) == 'http://') { visitor += "\n- Website URL is blank."; } else if( !isValidURL(F.linkUrl.value) ) { visitor += "\n- Invalid URL in website link."; } } if( F.linkDesc ) { if( Trim( F.linkDesc.value ) == '' ) { visitor += "\n- Website description is blank."; } else if( Trim(F.linkDesc.value.length) > 251 ) { visitor += "\n- Website description character limit is greater than max. limit."; } } if( F.linkCategory ) { if( Trim( F.linkCategory.value ) == '' ) { visitor += "\n- Category not selected."; } } if(visitor != "") { errorHeadString = errorHeadString + visitor; flag=true; } if (flag == true) { alert(errorHeadString); return false; }else { alert("Thank you, we will respond as soon as possible."); return true; // validation success } }