2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 {* Initialize jQuery validate *}
28 {* Extra params and functions may be added to the CRM.validate object before this template is loaded *}
31 <script type="text/javascript" >
34 'errorClass': 'crm-inline-error',
36 required: "{ts escape='js'}This field is required.{/ts}",
37 remote: "{ts escape='js'}Please fix this field.{/ts}",
38 email: "{ts escape='js'}Please enter a valid email address.{/ts}",
39 url: "{ts escape='js'}Please enter a valid URL.{/ts}",
40 date: "{ts escape='js'}Please enter a valid date.{/ts}",
41 dateISO: "{ts escape='js'}Please enter a valid date (ISO).{/ts}",
42 number: "{ts escape='js'}Please enter a valid number.{/ts}",
43 digits: "{ts escape='js'}Please enter only digits.{/ts}",
44 creditcard: "{ts escape='js'}Please enter a valid credit card number.{/ts}",
45 equalTo: "{ts escape='js'}Please enter the same value again.{/ts}",
46 accept: "{ts escape='js'}Please enter a value with a valid extension.{/ts}",
47 maxlength: $.validator.format("{ts escape='js'}Please enter no more than {ldelim}0{rdelim} characters.{/ts}"),
48 minlength: $.validator.format("{ts escape='js'}Please enter at least {ldelim}0{rdelim} characters.{/ts}"),
49 rangelength: $.validator.format("{ts escape='js'}Please enter a value between {ldelim}0{rdelim} and {ldelim}1{rdelim} characters long.{/ts}"),
50 range: $.validator.format("{ts escape='js'}Please enter a value between {ldelim}0{rdelim} and {ldelim}1{rdelim}.{/ts}"),
51 max: $.validator.format("{ts escape='js'}Please enter a value less than or equal to {ldelim}0{rdelim}.{/ts}"),
52 min: $.validator.format("{ts escape='js'}Please enter a value greater than or equal to {ldelim}0{rdelim}.{/ts}")
56 // use civicrm notifications when there are errors
57 params.invalidHandler = function(form, validator) {
58 var errors = validator.errorList;
59 {/literal}{if !$urlIsPublic}{literal}
60 for (var i in errors) {
61 $(errors[i].element).crmError(errors[i].message);
64 alert("{ts escape='js'}Please review and correct the highlighted fields before continuing.{/ts}");
68 CRM.validate.params = CRM.validate.params || {};
69 $.extend(CRM.validate.params, params);
72 {if $form && $form.formName}
73 $("#{$form.formName}").validate(params);
75 // Call any post-initialization callbacks
76 if (CRM.validate && CRM.validate.functions) {
77 for (var i in CRM.validate.functions) {
78 CRM.validate.functions[i]();