function validateForm(frm) { var error=false; var str=""; if(frm.yrequirements.value.length==0) { str=str+"Please Enter Your Requirements \n"; error=true; } if(frm.delivery_city.value.length==0) { str=str+"Please Enter the city name where you would like flowers to be delivered \n"; error=true; } if(frm.yname.value.length==0) { str=str+"Please Enter Your Name \n"; error=true; } if(frm.yemail.value.length==0) { str=str+"Please Enter Your Email \n"; error=true; } var eres=echeck(frm.yemail.value); if (eres!=true){ str=str+"Invalid Email Id \n"; error=true; } if(frm.yaddress.value.length==0) { str=str+"Please Enter Your Address \n"; error=true; } if(!CheckPhoneNumber(frm.yphone.value)) { str=str+"Please Enter Correct Phone Number \n"; error=true; } if(frm.ycity.value.length==0) { str=str+"Please Enter Your City \n"; error=true; } if(frm.yfax.value.length!=0) { if(!CheckPhoneNumber(frm.yfax.value)) { str=str+"Please Enter correct fax \n"; error=true; } } if(frm.ystate.value.length==0) { str=str+"Please Enter Your State \n"; error=true; } if(!CheckZipCode(frm.ypin.value)) { str=str+"Please Enter Correct zip code \n"; error=true; } if(frm.ycountry.value.length==0) { str=str+"Please Enter Your Country \n"; error=true; } var_security_code=frm.mcspvalue; var_sum=frm.sum; if(var_security_code.value=='') { str=str+"Please Enter Security Code \n"; error=true; } if(var_security_code.value!=var_sum.value) { str=str+"Invalid Security Code \n"; error=true; } if(error==true) { alert(str); return false; } else { return true; } } function validateAskForm(frm) { var error=false; var str=""; var_yname=frm.yname; var_yemail=frm.yemail; var_yphone=frm.yphone; var_security_code=frm.mcspvalue; var_sum=frm.sum; var_requirement=frm.requirement; var_order_value=frm.order_value; if(var_yname.value=='') { str=str+"Please Enter Your Name \n"; error=true; } if ((var_yemail.value==null)||(var_yemail.value=="")){ str=str+"Please Enter your email"; error=true; } var eres=echeck(var_yemail.value); if (eres!=true){ str=str+"Invalid Email Id \n"; error=true; } if(var_yphone.value=='') { str=str+"Please Enter Phone No. \n"; error=true; } if(isNaN(var_yphone.value)) { str=str+"Please Enter Correct Phone Number \n"; error=true; } if(var_requirement.value=='') { str=str+"Please Enter Description \n"; error=true; } if(var_order_value.value=='') { str=str+"Please Enter Order Value \n"; error=true; } if(isNaN(var_order_value.value)) { str=str+"Please Enter Number \n"; error=true; } if(var_security_code.value=='') { str=str+"Please Enter Security Code \n"; error=true; } if(var_security_code.value!=var_sum.value) { str=str+"Invalid Security Code \n"; error=true; } if(error==true) { alert(str); return false; } else { return true; } } ///////////////////////tell a friend validation//////// function checktellfriendform(frm) { var error=false; var str=""; if(frm.from_name.value.length==0) { str=str+"Please Enter Your Name \n"; error=true; } if(frm.from_email_address.value.length==0) { str=str+"Please Enter your email \n"; error=true; } var eres=echeck(frm.to_email_address.value); if (eres!=true){ str=str+"Invalid Email Id \n"; error=true; } if(frm.to_name.value.length==0) { str=str+"Please Enter Friend Name \n"; error=true; } if(frm.to_email_address.value.length==0) { str=str+"Please Enter Friend email \n"; error=true; } var eres=echeck(frm.to_email_address.value); if (eres!=true){ str=str+"Invalid Email Id \n"; error=true; } if(frm.mcspvalue.value=='') { str=str+"Please Enter Security Code \n"; error=true; } if(frm.mcspvalue.value!=frm.sum.value) { str=str+"Invalid Security Code\n"; error=true; } //mcspvalue if(error==true) { alert(str); return false; } else { return true; } } ////////////////////contact us validation//////// function checkcontactform(frm) { var error=false; var str=""; if(frm.cname.value.length==0) { str=str+"Please Enter Your Name \n"; error=true; } if(frm.from_email.value.length==0) { str=str+"Please Enter your email \n"; error=true; } var eres=echeck(frm.from_email.value); if (eres!=true){ str=str+"Invalid Email Id \n"; error=true; } if(!CheckPhoneNumber(frm.phone.value)) { str=str+"Please Enter Correct Phone Number \n"; error=true; } if(frm.comment.value.length==0) { str=str+"Please Enter Question/Details\n"; error=true; } if(frm.code2.value.length==0) { str=str+"Please Enter Security Code \n"; error=true; } if(error==true) { alert(str); return false; } else { return true; } } function echeck(str) { var at="@" var dot="." var lat=str.indexOf(at) var lstr=str.length var ldot=str.indexOf(dot) if (str.indexOf(at)==-1){ return "Invalid E-mail ID"; } if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return "Invalid E-mail ID"; } if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return "Invalid E-mail ID"; } if (str.indexOf(at,(lat+1))!=-1){ return "Invalid E-mail ID"; } if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return "Invalid E-mail ID"; } if (str.indexOf(dot,(lat+2))==-1){ return "Invalid E-mail ID"; } if (str.indexOf(" ")!=-1){ return "Invalid E-mail ID"; } return true } function CheckPhoneNumber(TheNumber) { var valid = 1 var GoodChars = "0123456789()-+ " var i = 0 if (TheNumber=="") { // Return false if number is empty valid = 0 } for (i =0; i <= TheNumber.length -1; i++) { if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) { // Note: Remove the comments from the following line to see this // for loop in action. // alert(TheNumber.charAt(i) + " is no good.") valid = 0 } // End if statement } // End for loop return valid } function CheckZipCode(TheNumber) { var valid = 1 var GoodChars = "0123456789" var i = 0 if (TheNumber=="") { // Return false if number is empty valid = 0 } for (i =0; i <= TheNumber.length -1; i++) { if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) { // Note: Remove the comments from the following line to see this // for loop in action. // alert(TheNumber.charAt(i) + " is no good.") valid = 0 } // End if statement } // End for loop return valid }