var base_url='http://www.emailmeform.com/builder/';var site_url='http://www.emailmeform.com/builder'; var g_emf_session_id="pbneon70oa3d8okqr7uplkjmd6"; /* * Inline Form Validation Engine 1.6.3, jQuery plugin * * Copyright(c) 2009, Cedric Dugas * http://www.position-relative.net * * Form validation engine allowing custom regex rules to be added. * Thanks to Francois Duquette * Licenced under the MIT Licence * swift rui modified */ (function($) { $.fn.validationEngine = function(settings) { if($.validationEngineLanguage){ // IS THERE A LANGUAGE LOCALISATION ? allRules = $.validationEngineLanguage.allRules; }else{ $.validationEngine.debug("Validation engine rules are not loaded check your external file"); } settings = jQuery.extend({ allrules:allRules, validationEventTriggers:"focusout", inlineValidation: true, returnIsValid:false, liveEvent:false, unbindEngine:true, ajaxSubmit: false, scroll:true, promptPosition: "topRight", // OPENNING BOX POSITION, IMPLEMENTED: topLeft, topRight, bottomLeft, centerRight, bottomRight success : false, beforeSuccess : function() {}, failure : function() {} }, settings); $.validationEngine.settings = settings; if(typeof($.validationEngine.ajaxValidArray)=="undefined") $.validationEngine.ajaxValidArray = new Array(); // ARRAY FOR AJAX: VALIDATION MEMORY if(settings.inlineValidation == true){ // Validating Inline ? if(!settings.returnIsValid){ // NEEDED FOR THE SETTING returnIsValid allowReturnIsvalid = false; if(settings.liveEvent){ // LIVE event, vast performance improvement over BIND $(this).find("[class*=validate][type!=checkbox]").live(settings.validationEventTriggers, function(caller){ _inlinEvent(this);}) $(this).find("[class*=validate][type=checkbox]").live("click", function(caller){ _inlinEvent(this); }) }else{ $(this).find("[class*=validate]").not("[type=checkbox]").bind(settings.validationEventTriggers, function(caller){ _inlinEvent(this); }) $(this).find("[class*=validate][type=checkbox]").bind("click", function(caller){ _inlinEvent(this); }) } firstvalid = false; } function _inlinEvent(caller){ $.validationEngine.settings = settings; if($.validationEngine.intercept == false || !$.validationEngine.intercept){ // STOP INLINE VALIDATION THIS TIME ONLY $.validationEngine.onSubmitValid=false; $.validationEngine.loadValidation(caller); }else{ $.validationEngine.intercept = false; } } } if (settings.returnIsValid){ // Do validation and return true or false, it bypass everything; if ($.validationEngine.submitValidation(this,settings)){ return false; }else{ return true; } } $(this).bind("submit", function(caller){ // ON FORM SUBMIT, CONTROL AJAX FUNCTION IF SPECIFIED ON DOCUMENT READY $.validationEngine.onSubmitValid = true; $.validationEngine.settings = settings; if($.validationEngine.submitValidation(this,settings) == false){ if($.validationEngine.submitForm(this,settings) == true) {return false;} }else{ settings.failure && settings.failure(); return false; } }) }; $.validationEngine = { defaultSetting : function(caller) { // NOT GENERALLY USED, NEEDED FOR THE API, DO NOT TOUCH if($.validationEngineLanguage){ allRules = $.validationEngineLanguage.allRules; }else{ $.validationEngine.debug("Validation engine rules are not loaded check your external file"); } settings = { allrules:allRules, validationEventTriggers:"blur", inlineValidation: true, returnIsValid:false, scroll:true, unbindEngine:true, ajaxSubmit: false, promptPosition: "topRight", // OPENNING BOX POSITION, IMPLEMENTED: topLeft, topRight, bottomLeft, centerRight, bottomRight success : false, failure : function() {} } $.validationEngine.settings = settings; }, loadValidation : function(caller) { // GET VALIDATIONS TO BE EXECUTED if(!$.validationEngine.settings){ $.validationEngine.defaultSetting() } rulesParsing = $(caller).attr('class'); rulesRegExp = /\[(.*)\]/; getRules = rulesRegExp.exec(rulesParsing); str = getRules[1]; pattern = /\[|,|\]/; result= str.split(pattern); var validateCalll = $.validationEngine.validateCall(caller,result) return validateCalll; }, validateCall : function(caller,rules) { // EXECUTE VALIDATION REQUIRED BY THE USER FOR THIS FIELD var promptText ="" if(!$(caller).attr("id")) { $.validationEngine.debug("This field have no ID attribut( name & class displayed): "+$(caller).attr("name")+" "+$(caller).attr("class")) } caller = caller; ajaxValidate = false; var callerName = $(caller).attr("name"); $.validationEngine.isError = false; $.validationEngine.showTriangle = true; callerType = get_property(caller, "type"); for (i=0; i 1 && (callerType == "radio" || callerType == "checkbox")) { // Hack for radio/checkbox group button, the validation go the first radio/checkbox of the group caller = $("input[name='"+callerName+"'][type!=hidden]:first"); /*to show triangle for radio and checkbox,modify by swift $.validationEngine.showTriangle = false; */ $.validationEngine.showTriangle = true; } } /* VALIDATION FUNCTIONS */ function _required(caller,rules){ // VALIDATE BLANK FIELD callerType = get_property(caller, "type"); if (callerType == "text" || callerType == "password" || callerType == "textarea" || callerType == "file"){ if(!$(caller).val()){ $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules[rules[i]].alertText+"
"; } } if (callerType == "radio" || callerType == "checkbox" ){ callerName = $(caller).attr("name"); if($("input[name='"+callerName+"']:checked").size() == 0) { $.validationEngine.isError = true; if($("input[name='"+callerName+"']").size() ==1) { promptText += $.validationEngine.settings.allrules[rules[i]].alertTextCheckboxe+"
"; }else{ promptText += $.validationEngine.settings.allrules[rules[i]].alertTextCheckboxMultiple+"
"; } } } if (callerType == "select-one") { // added by paul@kinetek.net for select boxes, Thank you if(!$(caller).val()) { $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules[rules[i]].alertText+"
"; } } if (callerType == "select-multiple") { // added by paul@kinetek.net for select boxes, Thank you if(!$(caller).find("option:selected").val()) { $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules[rules[i]].alertText+"
"; } } } function _customRegex(caller,rules,position){ // VALIDATE REGEX RULES customRule = rules[position+1]; pattern = eval($.validationEngine.settings.allrules[customRule].regex); if(!pattern.test($(caller).attr('value'))){ $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules[customRule].alertText+"
"; } } function _exemptString(caller,rules,position){ // VALIDATE REGEX RULES customString = rules[position+1]; if(customString == $(caller).attr('value')){ $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules['required'].alertText+"
"; } } function _funcCall(caller,rules,position){ // VALIDATE CUSTOM FUNCTIONS OUTSIDE OF THE ENGINE SCOPE customRule = rules[position+1]; params = rules.slice(position+2); funce = $.validationEngine.settings.allrules[customRule].fname; var fn = window[funce]; if (typeof(fn) === 'function'){ var fn_result = fn(caller,params); var is_error=false; var alert_text=$.validationEngine.settings.allrules[customRule].alertText;; if(typeof fn_result==='object'){ is_error=fn_result['is_error']; if(fn_result['message']){ alert_text=fn_result['message']; } }else{ is_error=fn_result; } $.validationEngine.isError = is_error; promptText += alert_text+"
"; } } function _ajax(caller,rules,position){ // VALIDATE AJAX RULES customAjaxRule = rules[position+1]; postfile = $.validationEngine.settings.allrules[customAjaxRule].file; fieldValue = $(caller).val(); ajaxCaller = caller; fieldId = $(caller).attr("id"); ajaxValidate = true; ajaxisError = $.validationEngine.isError; if($.validationEngine.settings.allrules[customAjaxRule].extraData){ var tempExtraData = $.validationEngine.settings.allrules[customAjaxRule].extraData; if(tempExtraData instanceof Function){ extraData=tempExtraData(); }else{ extraData=tempExtraData; } }else{ extraData = ""; } //log_for_debug('extraData:'+extraData+" : "+postfile); /* AJAX VALIDATION HAS ITS OWN UPDATE AND BUILD UNLIKE OTHER RULES */ if(!ajaxisError){ $.ajax({ type: "POST", url: postfile, async: true, data: "validateValue="+fieldValue+"&validateId="+fieldId+"&validateError="+customAjaxRule+"&"+extraData, beforeSend: function(){ // BUILD A LOADING PROMPT IF LOAD TEXT EXIST if($.validationEngine.settings.allrules[customAjaxRule].alertTextLoad){ if(!$("div."+fieldId+"formError")[0]){ return $.validationEngine.buildPrompt(ajaxCaller,$.validationEngine.settings.allrules[customAjaxRule].alertTextLoad,"load"); }else{ $.validationEngine.updatePromptText(ajaxCaller,$.validationEngine.settings.allrules[customAjaxRule].alertTextLoad,"load"); } } }, error: function(data,transport){ $.validationEngine.debug("error in the ajax (_ajax): "+data.status+" "+transport) }, success: function(data){ // GET SUCCESS DATA RETURN JSON data = eval( "("+data+")"); // GET JSON DATA FROM PHP AND PARSE IT ajaxisError = data.jsonValidateReturn[2]; customAjaxRule = data.jsonValidateReturn[1]; ajaxCaller = $("#"+data.jsonValidateReturn[0])[0]; fieldId = ajaxCaller; ajaxErrorLength = $.validationEngine.ajaxValidArray.length; existInarray = false; if(ajaxisError == "false"){ // DATA FALSE UPDATE PROMPT WITH ERROR; _checkInArray(false) // Check if ajax validation alreay used on this field if(!existInarray){ // Add ajax error to stop submit $.validationEngine.ajaxValidArray[ajaxErrorLength] = new Array(2); $.validationEngine.ajaxValidArray[ajaxErrorLength][0] = fieldId; $.validationEngine.ajaxValidArray[ajaxErrorLength][1] = false; existInarray = false; } $.validationEngine.ajaxValid = false; promptText += $.validationEngine.settings.allrules[customAjaxRule].alertText+"
"; $.validationEngine.updatePromptText(ajaxCaller,promptText,"",true); }else{ _checkInArray(true); $.validationEngine.ajaxValid = true; if($.validationEngine.settings.allrules[customAjaxRule].alertTextOk){ // NO OK TEXT MEAN CLOSE PROMPT $.validationEngine.updatePromptText(ajaxCaller,$.validationEngine.settings.allrules[customAjaxRule].alertTextOk,"pass",true); }else{ ajaxValidate = false; $.validationEngine.closePrompt(ajaxCaller); } } function _checkInArray(validate){ for(x=0;x";break; case "3":promptText += $.validationEngine.settings.allrules["confirm"].alertText3+"
";break; default:promptText += $.validationEngine.settings.allrules["confirm"].alertText+"
";break; } } } function _length(caller,rules,position){ // VALIDATE LENGTH startLength = eval(rules[position+1]); endLength = eval(rules[position+2]); feildLength = $(caller).attr('value').length; if(feildLengthendLength){ $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules["length"].alertText+startLength+$.validationEngine.settings.allrules["length"].alertText2+endLength+$.validationEngine.settings.allrules["length"].alertText3+"
" } } function _lengthWord(caller,rules,position){ // VALIDATE LENGTH startLength = eval(rules[position+1]); endLength = eval(rules[position+2]); feildLength = $.trim($(caller).attr('value')).split(' ').length; if(feildLengthendLength){ $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules["lengthWord"].alertText+startLength+$.validationEngine.settings.allrules["lengthWord"].alertText2+endLength+$.validationEngine.settings.allrules["lengthWord"].alertText3+"
" } } function _lengthValue(caller,rules,position){ // VALIDATE LENGTH startValue = eval(rules[position+1]); endValue = eval(rules[position+2]); feildValue = $.trim($(caller).attr('value')); if(feildValueendValue || isNaN(feildValue)){ $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules["lengthValue"].alertText+startValue+$.validationEngine.settings.allrules["lengthValue"].alertText2+endValue+$.validationEngine.settings.allrules["lengthValue"].alertText3+"
" } } function _maxCheckbox(caller,rules,position){ // VALIDATE CHECKBOX NUMBER nbCheck = eval(rules[position+1]); groupname = $(caller).attr("name"); groupSize = $("input[name='"+groupname+"']:checked").size(); if(groupSize > nbCheck){ $.validationEngine.showTriangle = false; $.validationEngine.isError = true; promptText += $.validationEngine.settings.allrules["maxCheckbox"].alertText+"
"; } } function _minCheckbox(caller,rules,position){ // VALIDATE CHECKBOX NUMBER nbCheck = eval(rules[position+1]); groupname = $(caller).attr("name"); groupSize = $("input[name='"+groupname+"']:checked").size(); if(groupSize < nbCheck){ $.validationEngine.isError = true; $.validationEngine.showTriangle = false; promptText += $.validationEngine.settings.allrules["minCheckbox"].alertText+" "+nbCheck+" "+$.validationEngine.settings.allrules["minCheckbox"].alertText2+"
"; } } function _minSelect(caller,rules,position){ // VALIDATE SELECT NUMBER nbCheck = eval(rules[position+1]); id_name = $(caller).attr("id"); groupSize = $("select[id='"+id_name+"'] option:selected").size(); if(groupSize < nbCheck){ $.validationEngine.isError = true; $.validationEngine.showTriangle = false; promptText += $.validationEngine.settings.allrules["minSelect"].alertText+" "+nbCheck+" "+$.validationEngine.settings.allrules["minSelect"].alertText2+"
"; } } return($.validationEngine.isError) ? $.validationEngine.isError : false; }, submitForm : function(caller){ if($.validationEngine.settings.ajaxSubmit){ if($.validationEngine.settings.ajaxSubmitExtraData){ extraData = $.validationEngine.settings.ajaxSubmitExtraData; }else{ extraData = ""; } $.ajax({ type: "POST", url: $.validationEngine.settings.ajaxSubmitFile, async: true, data: $(caller).serialize()+"&"+extraData, error: function(data,transport){ $.validationEngine.debug("error in the ajax (submitForm): "+data.status+" "+transport) }, success: function(data){ if(data == "true"){ // EVERYTING IS FINE, SHOW SUCCESS MESSAGE $(caller).css("opacity",1) $(caller).animate({opacity: 0, height: 0}, function(){ $(caller).css("display","none"); $(caller).before("
"+$.validationEngine.settings.ajaxSubmitMessage+"
"); $.validationEngine.closePrompt(".formError",true); $(".ajaxSubmit").show("slow"); if ($.validationEngine.settings.success){ // AJAX SUCCESS, STOP THE LOCATION UPDATE $.validationEngine.settings.success && $.validationEngine.settings.success(); return false; } }) }else{ // HOUSTON WE GOT A PROBLEM (SOMETING IS NOT VALIDATING) data = eval( "("+data+")"); if(!data.jsonValidateReturn){ $.validationEngine.debug("you are not going into the success fonction and jsonValidateReturn return nothing"); } errorNumber = data.jsonValidateReturn.length for(index=0; index
'); } if($.validationEngine.settings.promptPosition == "topLeft" || $.validationEngine.settings.promptPosition == "topRight"){ $(divFormError).append(arrow); $(arrow).html('
'); } } $(formErrorContent).html(promptText) callerTopPosition = $(caller).offset().top; callerleftPosition = $(caller).offset().left; callerWidth = $(caller).width(); inputHeight = $(divFormError).height(); /* POSITIONNING */ if($.validationEngine.settings.promptPosition == "topRight"){callerleftPosition += callerWidth -30; callerTopPosition += -inputHeight -10; } if($.validationEngine.settings.promptPosition == "topLeft"){ callerTopPosition += -inputHeight -10; } if($.validationEngine.settings.promptPosition == "centerRight"){ callerleftPosition += callerWidth +13; } if($.validationEngine.settings.promptPosition == "bottomLeft"){ callerHeight = $(caller).height(); callerleftPosition = callerleftPosition; callerTopPosition = callerTopPosition + callerHeight + 15; } if($.validationEngine.settings.promptPosition == "bottomRight"){ callerHeight = $(caller).height(); callerleftPosition += callerWidth -30; callerTopPosition += callerHeight + 15; } $(divFormError).css({ top:callerTopPosition, left:callerleftPosition, opacity:0 }); $(divFormError).click(function(){ $(this).remove(); }); return $(divFormError).animate({"opacity":0.87},function(){return true;}); }, updatePromptText : function(caller,promptText,type,ajaxed) { // UPDATE TEXT ERROR IF AN ERROR IS ALREADY DISPLAYED linkTofield = $.validationEngine.linkTofield(caller); var updateThisPrompt = "."+linkTofield; if(type == "pass") { $(updateThisPrompt).addClass("greenPopup") }else{ $(updateThisPrompt).removeClass("greenPopup")}; if(type == "load") { $(updateThisPrompt).addClass("blackPopup") }else{ $(updateThisPrompt).removeClass("blackPopup")}; if(ajaxed) { $(updateThisPrompt).addClass("ajaxed") }else{ $(updateThisPrompt).removeClass("ajaxed")}; $(updateThisPrompt).find(".formErrorContent").html(promptText); callerTopPosition = $(caller).offset().top; inputHeight = $(updateThisPrompt).height(); if($.validationEngine.settings.promptPosition == "bottomLeft" || $.validationEngine.settings.promptPosition == "bottomRight"){ callerHeight = $(caller).height(); callerTopPosition = callerTopPosition + callerHeight + 15; } if($.validationEngine.settings.promptPosition == "centerRight"){ callerleftPosition += callerWidth +13;} if($.validationEngine.settings.promptPosition == "topLeft" || $.validationEngine.settings.promptPosition == "topRight"){ callerTopPosition = callerTopPosition -inputHeight -10; } $(updateThisPrompt).animate({ top:callerTopPosition }); }, linkTofield : function(caller){ linkTofield = $(caller).attr("id") + "formError"; linkTofield = linkTofield.replace(/\[/g,""); linkTofield = linkTofield.replace(/\]/g,""); return linkTofield; }, closePrompt : function(caller,outside) { // CLOSE PROMPT WHEN ERROR CORRECTED if(!$.validationEngine.settings){ $.validationEngine.defaultSetting() } if(outside){ $(caller).fadeTo("fast",0,function(){ $(caller).remove(); }); return false; } if(typeof(ajaxValidate)=='undefined'){ajaxValidate = false} if(!ajaxValidate){ linkTofield = $.validationEngine.linkTofield(caller); closingPrompt = "."+linkTofield; $(closingPrompt).fadeTo("fast",0,function(){ $(closingPrompt).remove(); }); } }, debug : function(error) { if(!$("#debugMode")[0]){ $("body").append("
This is a debug mode, you got a problem with your form, it will try to help you, refresh when you think you nailed down the problem
"); } $(".debugError").append("
"+error+"
"); }, submitValidation : function(caller) { // FORM SUBMIT VALIDATION LOOPING INLINE VALIDATION var stopForm = false; $.validationEngine.ajaxValid = true; $(caller).find(".formError").remove(); var toValidateSize = $(caller).find("[class*=validate]").size(); $(caller).find("[class*=validate]").each(function(){ linkTofield = $.validationEngine.linkTofield(this); if(!$("."+linkTofield).hasClass("ajaxed")){ // DO NOT UPDATE ALREADY AJAXED FIELDS (only happen if no normal errors, don't worry) var validationPass = $.validationEngine.loadValidation(this); return(validationPass) ? stopForm = true : ""; }; }); ajaxErrorLength = $.validationEngine.ajaxValidArray.length; // LOOK IF SOME AJAX IS NOT VALIDATE for(x=0;xtestDestination){ destination = $(this).offset().top; } }) $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100); } return true; }else{ return false; } } } })(jQuery);;var EMF_jQuery=jQuery; (function($) { $.fn.validationEngineLanguage = function() {}; $.validationEngineLanguage = { newLang: function() { $.validationEngineLanguage.allRules = { "required":{ // Add your regex rules here, you can take telephone as an example "regex":"none", "alertText":"* This field is required", "alertTextCheckboxMultiple":"* Please select an option", "alertTextCheckboxe":"* This checkbox is required"}, "length":{ "regex":"none", "alertText":"*Between ", "alertText2":" and ", "alertText3": " characters allowed"}, "lengthWord":{ "regex":"none", "alertText":"*Between ", "alertText2":" and ", "alertText3": " words allowed"}, "lengthValue":{ "regex":"none", "alertText":"*Between ", "alertText2":" and ", "alertText3": " value allowed"}, "maxCheckbox":{ "regex":"none", "alertText":"* Checks allowed Exceeded"}, "minCheckbox":{ "regex":"none", "alertText":"* Please select ", "alertText2":" options"}, "minSelect":{ "regex":"none", "alertText":"* Please select ", "alertText2":" options"}, "confirm":{ "regex":"none", "alertText":"* Your field is not matching", "alertText2":"* The password entered does not match. Please try again.", "alertText3":"* The email does not match. Please try again."}, "telephone":{ "regex":"/^[0-9\-\(\)\+\ ]+$/", "alertText":"* Invalid phone number"}, "email":{ "regex":"/^[a-zA-Z0-9_\.\+\-]+\@([a-zA-Z0-9\-]+\.)+[a-zA-Z0-9]{2,4}$/", "alertText":"* Invalid email address"}, "url":{ "regex":/^((https?|ftp):\/\/)?(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, "alertText":"* Invalid website address"}, "date":{ "regex":"/^[0-9]{4}\-\[0-9]{1,2}\-\[0-9]{1,2}$/", "alertText":"* Invalid date, must be in YYYY-MM-DD format"}, "onlyNumber":{ "regex":"/^[0-9\ ]+$/", "alertText":"* Numbers only"}, "extNumber":{ "regex":"/^[0-9,\.\ ]+$/", "alertText":"* Numbers only"}, "noSpecialCaracters":{ "regex":"/^[0-9a-zA-Z]+$/", "alertText":"* No special caracters allowed"}, "noSpecialCaractersEx":{ "regex":/^[0-9a-zA-Z\ \-\&\']+$/, "alertText":"* No special caracters allowed"}, /* "ajaxCaptcha":{ "file":get_site_url('forms/check_captcha_code'), "extraData":"captcha_code="+$('#captcha_code').val(), "alertTextOk":"* This captcha is available", "alertTextLoad":"* Loading, please wait", "alertText":"* This captcha is wrong" }, */ "ajaxPassword":{ "file":get_site_url('account/check_password'), "extraData":"Password="+$('#Password').val(), "alertTextOk":"* Old Password is correct", "alertTextLoad":"* Loading, please wait", "alertText":"* Old Password is wrong" }, "onlyLetter":{ "regex":"/^[a-zA-Z\ \']+$/", "alertText":"* Letters only" }, "ajaxUsername":{ "file":get_site_url('account/check_user'), "extraData":"Username="+$('#Username').val(), "alertTextOk":"* This user is available", "alertTextLoad":"* Loading, please wait", "alertText":"* This user is already taken" }, "ajaxEmail":{ "file":get_site_url('account/check_email'), "extraData":"ContactEmail="+$('#ContactEmail').val(), "alertTextOk":"* This email is available", "alertTextLoad":"* Loading, please wait", "alertText":"* This email is already taken" }, "NameEmail":{ "fname":"NameEmail", "alertText":"* Invalid email address" }, "valid_captcha":{ "fname":"valid_captcha", "alertText":"* This captcha is wrong" }, "url_ex":{ "fname":"url_ex", "alertText":"* Invalid website address" /*, "alertText2":"* Valid URL start with 'http://' or 'https://' is allowed." */ }, "check_file_error":{ "fname":"check_file_error", "alertText":"* File type invalid or file size is too large" } } } } })(jQuery); EMF_jQuery(document).ready(function() { EMF_jQuery.validationEngineLanguage.newLang(); });; /** * options:{modal=false, width='auto', height='auto', resizable=false,title="",hide_after_create=false} * */ function show_dialog(id,options){ var modal=false; var width='auto'; var height='auto'; var resizable=false; var title=''; var hide_close_button=false; var close_on_escape=false; if(typeof(options)!='undefined' && options){ if(options['modal']==true){ modal=true; } if(options['width']){ width=options['width']; } if(options['height']){ height=options['height']; } if(options['resizable']==true){ resizable=options['resizable']; } if(options['title']){ title=options['title']; } if(options['hide_close_button']){ hide_close_button=options['hide_close_button']; } if(typeof(options['closeOnEscape'])=='undefined'){ close_on_escape=!hide_close_button; }else{ close_on_escape=options['closeOnEscape']; } } //debug_log("modal:"+modal+" height:"+height+" width:"+width); $("#"+id).dialog({title:title,modal: modal,resizable:resizable,width:width,height:height,dialogClass:'emf_dialog',closeOnEscape: close_on_escape}); if(hide_close_button){ closeOnEscape: false, $("#"+id).parents('.ui-dialog').find('.ui-dialog-titlebar-close').hide(); } } function rand_id(){ var id=""+Math.random(); return "id_"+id.substr(2); } function debug_log(msg){ // console.debug(msg); } /** * options:{ * modal=false, width='auto', height='auto', resizable=false,title="",hide_after_create=false,custom_id=null,destory_after_close=false, * image_buttons:{},text_buttons:{},list_buttons:{} * } * */ function create_dialog(title,html_content,options){ //create dialog // debug_log(options); if(typeof(options)=='undefined' || options==null){ options={}; } var custom_id=null; var enable_show_dialog=true; // var destory_after_close=false; custom_id=options['custom_id']; if(options['hide_after_create']){ enable_show_dialog=false; } // if(options['destory_after_close']==true){ // destory_after_close=true; // } var id; var found_dialog=false; if(custom_id){ //search custom_id if($("#"+custom_id).length>0){ found_dialog=true; } id=custom_id; }else{ id=rand_id(); } // debug_log("found_dialog:"+found_dialog); if(found_dialog){ var title_html=""; if(title){ title_html="

"+title+"

"; } $("#"+id+" .TB_content_caption").html(title_html+"\n"+(html_content?html_content:"")); }else{ var title_html=""; if(title){ title_html="

"+title+"

"; } var html="