C:\wamp\www\phpld 4.2.1\PhpLD\templates\Professional\validation.tpl | C:\wamp\www\phpld42\PhpLD\templates\Professional\validation.tpl
1 {literal} 2 <script type="text/javascript"> 3 jQuery(document).ready(function(){ 4 {/literal} 5 {foreach from=$validation_messages item=i key=k} 6 {if $k eq 'maxlength' || $k eq 'minlength' || $k eq 'rangelength' || $k eq 'range' || $k eq 'max' || $k eq 'min'} 7 jQuery.validator.messages.{$k} = jQuery.format("{$i}"); 8 {else} 9 jQuery.validator.messages.{$k} = "{$i}"; 10 {/if} 11 {/foreach} 12 {literal} 13 14 function fireEvent(obj, evt) { 15 var fireOnThis = obj; 16 if (document.createEvent) { 17 var evObj = document.createEvent('MouseEvents'); 18 evObj.initEvent(evt, true, false); 19 fireOnThis.dispatchEvent(evObj); 20 } else if (document.createEventObject) { 21 fireOnThis.fireEvent('on'+evt); 22 } 23 } 24 25 //valid obj isntantiated in header.tpl 26 valid_obj.{/literal}{$form_id}{literal} = { 27 debug: false, 28 onKeyUp: true, 29 onfocusout: false, 30 errorElement: "span", 31 errorClass: "errForm", 32 submitHandler: function(form) { 33 // do other stuff for a valid form 34 if (jQuery("#{/literal}{$form_id}{literal}").valid()) { 35 form.submit(); 36 } 37 }, 38 39 {/literal}{$validators}{literal} 40 }; 41 42 jQuery("#{/literal}{$form_id}{literal}").validate(valid_obj.{/literal}{$form_id}{literal}); 43 44 var selects = jQuery("#{/literal}{$form_id}{literal}").find("select"); 45 var crt; 46 jQuery.each(selects, function() { 47 crt = this.id; 48 if(typeof(valid_obj.{/literal}{$form_id}{literal}.rules[crt]) !== 'undefined') { 49 jQuery("#"+crt).change(function() { 50 jQuery(this).valid(); 51 }); 52 } 53 }); 54 }); 55 </script> 56 {/literal} | 1 {literal} 2 <script type="text/javascript"> 3 jQuery(function($) { 4 $(document).ready(function(){ 5 {/literal} 6 {foreach from=$validation_messages item=i key=k} 7 {if $k eq 'maxlength' || $k eq 'minlength' || $k eq 'rangelength' || $k eq 'range' || $k eq 'max' || $k eq 'min'} 8 jQuery.validator.messages.{$k} = $.format("{$i}"); 9 {else} 10 jQuery.validator.messages.{$k} = "{$i}"; 11 {/if} 12 {/foreach} 13 {literal} 14 15 function fireEvent(obj, evt) { 16 var fireOnThis = obj; 17 if (document.createEvent) { 18 var evObj = document.createEvent('MouseEvents'); 19 evObj.initEvent(evt, true, false); 20 fireOnThis.dispatchEvent(evObj); 21 } else if (document.createEventObject) { 22 fireOnThis.fireEvent('on'+evt); 23 } 24 } 25 26 //valid obj isntantiated in header.tpl 27 valid_obj.{/literal}{$form_id}{literal} = { 28 debug: false, 29 onKeyUp: true, 30 onfocusout: false, 31 errorElement: "span", 32 errorClass: "errForm", 33 submitHandler: function(form) { 34 // do other stuff for a valid form 35 if ($("#{/literal}{$form_id}{literal}").valid()) { 36 form.submit(); 37 } 38 }, 39 40 {/literal}{$validators}{literal} 41 }; 42 43 $("#{/literal}{$form_id}{literal}").validate(valid_obj.{/literal}{$form_id}{literal}); 44 45 var selects = $("#{/literal}{$form_id}{literal}").find("select"); 46 var crt; 47 $.each(selects, function() { 48 crt = this.id; 49 if(typeof(valid_obj.{/literal}{$form_id}{literal}.rules[crt]) !== 'undefined') { 50 $("#"+crt).change(function() { 51 $(this).valid(); 52 }); 53 } 54 }); 55 }); 56 }); 57 </script> 58 {/literal}
Legend: | Added(1,1) | Deleted(0,0) | Changed(9) | Changed in changed(8)