137 lines
6.2 KiB
JavaScript
137 lines
6.2 KiB
JavaScript
// var reg_business_name = /[^A-Za-z0-9!?. \-,'&():\|\"+@%]+/g;
|
|
// var reg_zip = /[^0-9]+/g;
|
|
// var reg_addr = /[^A-Za-z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ .\-'`,#\/]+/g;
|
|
// var reg_city = /[^A-Za-z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ .\-'`]+/g;
|
|
// var reg_name = /[^A-Za-z1-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ .\-'`,]+/g;
|
|
// var reg_desc = /[^A-Za-z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ!?. \-,'\/&():|\"+@%$£]+/g;
|
|
// var reg_comma = /[^A-Za-z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿŒœŠšŸ!?. \-,\/&#']+/g;
|
|
// var reg_tollfree = /^(\+?1)?(8(00|55|66|77|88)[2-9]\d{6})/;
|
|
|
|
|
|
// var validate_via_regex = function(str, regex){
|
|
// var matches = str.match(regex);
|
|
// if (matches === null){
|
|
// return true;
|
|
// } else {
|
|
// return matches;
|
|
// }
|
|
// };
|
|
|
|
// var validations = function(){
|
|
// $("input.remove_title").attr("title", "");
|
|
// $("#form").validate({
|
|
// rules: {
|
|
// business_name: "reg_business_name",
|
|
// address_line_1: "reg_addr",
|
|
// address_line_2: "reg_addr",
|
|
// city: "reg_city",
|
|
// business_description: "reg_desc",
|
|
// primary_contact_name: "reg_name",
|
|
// postal_code: "reg_zip",
|
|
// business_email_address: "email",
|
|
// business_website: "url",
|
|
// social_media_link: "url",
|
|
// products_commadelimited: "reg_comma",
|
|
// keyword_specialties_commadelimited: "reg_comma",
|
|
// areas_served_commadelimited: "reg_comma",
|
|
// professional_associations_commadelimited: "reg_comma",
|
|
// services_commadelimited: "reg_comma",
|
|
// logo_url: "url",
|
|
// photo_url_1: "url",
|
|
// phone_number: "tollfree"
|
|
// }
|
|
// });
|
|
|
|
// $("#id_business_name").rules("add", {maxlength: 60 });
|
|
// $("#id_address_line_1").rules("add", {maxlength: 30 });
|
|
// $("#id_address_line_2").rules("add", {maxlength: 20 });
|
|
// $("#id_city").rules("add", {maxlength: 20 });
|
|
// $("#id_primary_contact_name").rules("add", {maxlength: 75 });
|
|
// $("#id_business_email_address").rules("add", {maxlength: 200 });
|
|
// $("#id_business_website").rules("add", {maxlength: 50 });
|
|
// $("#id_social_media_link").rules("add", {maxlength: 200 });
|
|
// $("#id_business_description").rules("add", {maxlength: 200 });
|
|
// $("#id_products_commadelimited").rules("add", {maxlength: 200 });
|
|
// $("#id_keyword_specialties_commadelimited").rules("add", {maxlength: 200 });
|
|
// $("#id_areas_served_commadelimited").rules("add", {maxlength: 100 });
|
|
// $("#id_professional_associations_commadelimited").rules("add", {maxlength: 200 });
|
|
// $("#id_services_commadelimited").rules("add", {maxlength: 200 });
|
|
// $("#id_logo_url").rules("add", {maxlength: 136 /* Strip off http:// */ });
|
|
// $("#id_photo_url_1").rules("add", {maxlength: 200 });
|
|
|
|
// $.validator.addMethod("reg_addr", function(value, element) {
|
|
// var results = validate_via_regex(value, reg_addr);
|
|
// if (results !== true){
|
|
// $(element).prop("title","Please provide a properly formatted Address. Invalid characters: " + results.join(""));
|
|
// return false;
|
|
// }
|
|
// return results;
|
|
// });
|
|
|
|
// $.validator.addMethod("tollfree", function(value, element) {
|
|
// var results = validate_via_regex(value.replace(/\D/g,''), reg_tollfree);
|
|
// console.log("go");
|
|
// if (results !== true){
|
|
// $(element).prop("title","Toll-free numbers aren't accepted as the primary phone number");
|
|
// return false;
|
|
// }
|
|
// return results;
|
|
// });
|
|
|
|
// $.validator.addMethod("reg_business_name", function(value, element) {
|
|
// var results = validate_via_regex(value, reg_business_name);
|
|
// if (results !== true){
|
|
// $(element).prop("title","Please provide a properly formatted Business Name. Invalid characters: " + results.join(""));
|
|
// return false;
|
|
// }
|
|
// return results;
|
|
// });
|
|
|
|
// $.validator.addMethod("reg_city", function(value, element) {
|
|
// var results = validate_via_regex(value, reg_city);
|
|
// if (results !== true){
|
|
// $(element).prop("title","Please provide a properly formatted City name. Invalid characters: " + results.join(""));
|
|
// return false;
|
|
// }
|
|
// return results;
|
|
// });
|
|
|
|
// $.validator.addMethod("reg_comma", function(value, element) {
|
|
// var results = validate_via_regex(value, reg_comma);
|
|
// if (results !== true){
|
|
// $(element).prop("title","Please provide a properly formatted entry. Invalid characters: " + results.join(""));
|
|
// return false;
|
|
// }
|
|
// return results;
|
|
// });
|
|
|
|
// $.validator.addMethod("reg_desc", function(value, element) {
|
|
// var results = validate_via_regex(value, reg_desc);
|
|
// if (results !== true){
|
|
// $(element).prop("title","Please provide a properly formatted Description. Invalid characters: " + results.join(""));
|
|
// return false;
|
|
// }
|
|
// return results;
|
|
// });
|
|
|
|
// $.validator.addMethod("reg_name", function(value, element) {
|
|
// var results = validate_via_regex(value, reg_name);
|
|
// if (results !== true){
|
|
// $(element).prop("title","Please provide a properly formatted Contact Name. Invalid characters: " + results.join(""));
|
|
// return false;
|
|
// }
|
|
// return results;
|
|
// });
|
|
|
|
|
|
|
|
// $.validator.addMethod("reg_zip", function(value, element) {
|
|
// var results = validate_via_regex(value, reg_zip);
|
|
// if (results !== true){
|
|
// $(element).prop("title","Please provide a properly formatted ZIP code. Invalid characters: " + results.join(""));
|
|
// return false;
|
|
// }
|
|
// return results;
|
|
// });
|
|
// };
|
|
; |