annotate Agendas/trunk/src/Agendas.Web/Scripts/MicrosoftMvcValidation.debug.js @ 110:a456eb519e23

Lanzando twitts desde el sitio con la cuenta de AltNetHispanoDESA
author Nelo@Kenia.neluz.int
date Wed, 08 Jun 2011 07:33:14 -0300
parents c62b77fc33f4
children
rev   line source
10
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
1 //!----------------------------------------------------------
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
2 //! Copyright (C) Microsoft Corporation. All rights reserved.
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
3 //!----------------------------------------------------------
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
4 //! MicrosoftMvcValidation.js
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
5
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
6
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
7 Type.registerNamespace('Sys.Mvc');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
8
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
9 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
10 // Sys.Mvc.Validation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
11
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
12 Sys.Mvc.$create_Validation = function Sys_Mvc_Validation() { return {}; }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
13
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
14
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
15 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
16 // Sys.Mvc.JsonValidationField
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
17
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
18 Sys.Mvc.$create_JsonValidationField = function Sys_Mvc_JsonValidationField() { return {}; }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
19
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
20
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
21 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
22 // Sys.Mvc.JsonValidationOptions
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
23
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
24 Sys.Mvc.$create_JsonValidationOptions = function Sys_Mvc_JsonValidationOptions() { return {}; }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
25
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
26
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
27 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
28 // Sys.Mvc.JsonValidationRule
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
29
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
30 Sys.Mvc.$create_JsonValidationRule = function Sys_Mvc_JsonValidationRule() { return {}; }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
31
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
32
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
33 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
34 // Sys.Mvc.ValidationContext
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
35
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
36 Sys.Mvc.$create_ValidationContext = function Sys_Mvc_ValidationContext() { return {}; }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
37
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
38
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
39 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
40 // Sys.Mvc.NumberValidator
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
41
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
42 Sys.Mvc.NumberValidator = function Sys_Mvc_NumberValidator() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
43 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
44 Sys.Mvc.NumberValidator.create = function Sys_Mvc_NumberValidator$create(rule) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
45 /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
46 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
47 /// <returns type="Sys.Mvc.Validator"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
48 return Function.createDelegate(new Sys.Mvc.NumberValidator(), new Sys.Mvc.NumberValidator().validate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
49 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
50 Sys.Mvc.NumberValidator.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
51
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
52 validate: function Sys_Mvc_NumberValidator$validate(value, context) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
53 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
54 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
55 /// <param name="context" type="Sys.Mvc.ValidationContext">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
56 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
57 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
58 if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
59 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
60 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
61 var n = Number.parseLocale(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
62 return (!isNaN(n));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
63 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
64 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
65
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
66
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
67 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
68 // Sys.Mvc.FormContext
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
69
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
70 Sys.Mvc.FormContext = function Sys_Mvc_FormContext(formElement, validationSummaryElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
71 /// <param name="formElement" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
72 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
73 /// <param name="validationSummaryElement" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
74 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
75 /// <field name="_validationSummaryErrorCss" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
76 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
77 /// <field name="_validationSummaryValidCss" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
78 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
79 /// <field name="_formValidationTag" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
80 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
81 /// <field name="_onClickHandler" type="Sys.UI.DomEventHandler">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
82 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
83 /// <field name="_onSubmitHandler" type="Sys.UI.DomEventHandler">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
84 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
85 /// <field name="_errors" type="Array">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
86 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
87 /// <field name="_submitButtonClicked" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
88 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
89 /// <field name="_validationSummaryElement" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
90 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
91 /// <field name="_validationSummaryULElement" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
92 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
93 /// <field name="fields" type="Array" elementType="FieldContext">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
94 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
95 /// <field name="_formElement" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
96 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
97 /// <field name="replaceValidationSummary" type="Boolean">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
98 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
99 this._errors = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
100 this.fields = new Array(0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
101 this._formElement = formElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
102 this._validationSummaryElement = validationSummaryElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
103 formElement[Sys.Mvc.FormContext._formValidationTag] = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
104 if (validationSummaryElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
105 var ulElements = validationSummaryElement.getElementsByTagName('ul');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
106 if (ulElements.length > 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
107 this._validationSummaryULElement = ulElements[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
108 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
109 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
110 this._onClickHandler = Function.createDelegate(this, this._form_OnClick);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
111 this._onSubmitHandler = Function.createDelegate(this, this._form_OnSubmit);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
112 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
113 Sys.Mvc.FormContext._Application_Load = function Sys_Mvc_FormContext$_Application_Load() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
114 var allFormOptions = window.mvcClientValidationMetadata;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
115 if (allFormOptions) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
116 while (allFormOptions.length > 0) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
117 var thisFormOptions = allFormOptions.pop();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
118 Sys.Mvc.FormContext._parseJsonOptions(thisFormOptions);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
119 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
120 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
121 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
122 Sys.Mvc.FormContext._getFormElementsWithName = function Sys_Mvc_FormContext$_getFormElementsWithName(formElement, name) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
123 /// <param name="formElement" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
124 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
125 /// <param name="name" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
126 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
127 /// <returns type="Array" elementType="Object" elementDomElement="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
128 var allElementsWithNameInForm = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
129 var allElementsWithName = document.getElementsByName(name);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
130 for (var i = 0; i < allElementsWithName.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
131 var thisElement = allElementsWithName[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
132 if (Sys.Mvc.FormContext._isElementInHierarchy(formElement, thisElement)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
133 Array.add(allElementsWithNameInForm, thisElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
134 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
135 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
136 return allElementsWithNameInForm;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
137 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
138 Sys.Mvc.FormContext.getValidationForForm = function Sys_Mvc_FormContext$getValidationForForm(formElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
139 /// <param name="formElement" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
140 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
141 /// <returns type="Sys.Mvc.FormContext"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
142 return formElement[Sys.Mvc.FormContext._formValidationTag];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
143 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
144 Sys.Mvc.FormContext._isElementInHierarchy = function Sys_Mvc_FormContext$_isElementInHierarchy(parent, child) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
145 /// <param name="parent" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
146 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
147 /// <param name="child" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
148 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
149 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
150 while (child) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
151 if (parent === child) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
152 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
153 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
154 child = child.parentNode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
155 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
156 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
157 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
158 Sys.Mvc.FormContext._parseJsonOptions = function Sys_Mvc_FormContext$_parseJsonOptions(options) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
159 /// <param name="options" type="Sys.Mvc.JsonValidationOptions">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
160 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
161 /// <returns type="Sys.Mvc.FormContext"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
162 var formElement = $get(options.FormId);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
163 var validationSummaryElement = (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(options.ValidationSummaryId)) ? $get(options.ValidationSummaryId) : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
164 var formContext = new Sys.Mvc.FormContext(formElement, validationSummaryElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
165 formContext.enableDynamicValidation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
166 formContext.replaceValidationSummary = options.ReplaceValidationSummary;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
167 for (var i = 0; i < options.Fields.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
168 var field = options.Fields[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
169 var fieldElements = Sys.Mvc.FormContext._getFormElementsWithName(formElement, field.FieldName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
170 var validationMessageElement = (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(field.ValidationMessageId)) ? $get(field.ValidationMessageId) : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
171 var fieldContext = new Sys.Mvc.FieldContext(formContext);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
172 Array.addRange(fieldContext.elements, fieldElements);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
173 fieldContext.validationMessageElement = validationMessageElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
174 fieldContext.replaceValidationMessageContents = field.ReplaceValidationMessageContents;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
175 for (var j = 0; j < field.ValidationRules.length; j++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
176 var rule = field.ValidationRules[j];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
177 var validator = Sys.Mvc.ValidatorRegistry.getValidator(rule);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
178 if (validator) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
179 var validation = Sys.Mvc.$create_Validation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
180 validation.fieldErrorMessage = rule.ErrorMessage;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
181 validation.validator = validator;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
182 Array.add(fieldContext.validations, validation);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
183 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
184 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
185 fieldContext.enableDynamicValidation();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
186 Array.add(formContext.fields, fieldContext);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
187 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
188 var registeredValidatorCallbacks = formElement.validationCallbacks;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
189 if (!registeredValidatorCallbacks) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
190 registeredValidatorCallbacks = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
191 formElement.validationCallbacks = registeredValidatorCallbacks;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
192 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
193 registeredValidatorCallbacks.push(Function.createDelegate(null, function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
194 return Sys.Mvc._validationUtil.arrayIsNullOrEmpty(formContext.validate('submit'));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
195 }));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
196 return formContext;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
197 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
198 Sys.Mvc.FormContext.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
199 _onClickHandler: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
200 _onSubmitHandler: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
201 _submitButtonClicked: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
202 _validationSummaryElement: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
203 _validationSummaryULElement: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
204 _formElement: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
205 replaceValidationSummary: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
206
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
207 addError: function Sys_Mvc_FormContext$addError(message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
208 /// <param name="message" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
209 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
210 this.addErrors([ message ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
211 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
212
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
213 addErrors: function Sys_Mvc_FormContext$addErrors(messages) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
214 /// <param name="messages" type="Array" elementType="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
215 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
216 if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(messages)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
217 Array.addRange(this._errors, messages);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
218 this._onErrorCountChanged();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
219 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
220 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
221
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
222 clearErrors: function Sys_Mvc_FormContext$clearErrors() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
223 Array.clear(this._errors);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
224 this._onErrorCountChanged();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
225 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
226
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
227 _displayError: function Sys_Mvc_FormContext$_displayError() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
228 if (this._validationSummaryElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
229 if (this._validationSummaryULElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
230 Sys.Mvc._validationUtil.removeAllChildren(this._validationSummaryULElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
231 for (var i = 0; i < this._errors.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
232 var liElement = document.createElement('li');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
233 Sys.Mvc._validationUtil.setInnerText(liElement, this._errors[i]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
234 this._validationSummaryULElement.appendChild(liElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
235 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
236 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
237 Sys.UI.DomElement.removeCssClass(this._validationSummaryElement, Sys.Mvc.FormContext._validationSummaryValidCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
238 Sys.UI.DomElement.addCssClass(this._validationSummaryElement, Sys.Mvc.FormContext._validationSummaryErrorCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
239 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
240 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
241
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
242 _displaySuccess: function Sys_Mvc_FormContext$_displaySuccess() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
243 var validationSummaryElement = this._validationSummaryElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
244 if (validationSummaryElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
245 var validationSummaryULElement = this._validationSummaryULElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
246 if (validationSummaryULElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
247 validationSummaryULElement.innerHTML = '';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
248 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
249 Sys.UI.DomElement.removeCssClass(validationSummaryElement, Sys.Mvc.FormContext._validationSummaryErrorCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
250 Sys.UI.DomElement.addCssClass(validationSummaryElement, Sys.Mvc.FormContext._validationSummaryValidCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
251 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
252 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
253
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
254 enableDynamicValidation: function Sys_Mvc_FormContext$enableDynamicValidation() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
255 Sys.UI.DomEvent.addHandler(this._formElement, 'click', this._onClickHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
256 Sys.UI.DomEvent.addHandler(this._formElement, 'submit', this._onSubmitHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
257 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
258
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
259 _findSubmitButton: function Sys_Mvc_FormContext$_findSubmitButton(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
260 /// <param name="element" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
261 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
262 /// <returns type="Object" domElement="true"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
263 if (element.disabled) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
264 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
265 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
266 var tagName = element.tagName.toUpperCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
267 var inputElement = element;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
268 if (tagName === 'INPUT') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
269 var type = inputElement.type;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
270 if (type === 'submit' || type === 'image') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
271 return inputElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
272 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
273 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
274 else if ((tagName === 'BUTTON') && (inputElement.type === 'submit')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
275 return inputElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
276 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
277 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
278 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
279
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
280 _form_OnClick: function Sys_Mvc_FormContext$_form_OnClick(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
281 /// <param name="e" type="Sys.UI.DomEvent">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
282 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
283 this._submitButtonClicked = this._findSubmitButton(e.target);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
284 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
285
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
286 _form_OnSubmit: function Sys_Mvc_FormContext$_form_OnSubmit(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
287 /// <param name="e" type="Sys.UI.DomEvent">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
288 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
289 var form = e.target;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
290 var submitButton = this._submitButtonClicked;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
291 if (submitButton && submitButton.disableValidation) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
292 return;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
293 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
294 var errorMessages = this.validate('submit');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
295 if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(errorMessages)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
296 e.preventDefault();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
297 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
298 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
299
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
300 _onErrorCountChanged: function Sys_Mvc_FormContext$_onErrorCountChanged() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
301 if (!this._errors.length) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
302 this._displaySuccess();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
303 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
304 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
305 this._displayError();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
306 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
307 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
308
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
309 validate: function Sys_Mvc_FormContext$validate(eventName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
310 /// <param name="eventName" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
311 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
312 /// <returns type="Array" elementType="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
313 var fields = this.fields;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
314 var errors = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
315 for (var i = 0; i < fields.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
316 var field = fields[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
317 if (!field.elements[0].disabled) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
318 var thisErrors = field.validate(eventName);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
319 if (thisErrors) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
320 Array.addRange(errors, thisErrors);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
321 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
322 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
323 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
324 if (this.replaceValidationSummary) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
325 this.clearErrors();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
326 this.addErrors(errors);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
327 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
328 return errors;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
329 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
330 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
331
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
332
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
333 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
334 // Sys.Mvc.FieldContext
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
335
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
336 Sys.Mvc.FieldContext = function Sys_Mvc_FieldContext(formContext) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
337 /// <param name="formContext" type="Sys.Mvc.FormContext">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
338 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
339 /// <field name="_hasTextChangedTag" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
340 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
341 /// <field name="_hasValidationFiredTag" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
342 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
343 /// <field name="_inputElementErrorCss" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
344 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
345 /// <field name="_inputElementValidCss" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
346 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
347 /// <field name="_validationMessageErrorCss" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
348 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
349 /// <field name="_validationMessageValidCss" type="String" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
350 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
351 /// <field name="_onBlurHandler" type="Sys.UI.DomEventHandler">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
352 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
353 /// <field name="_onChangeHandler" type="Sys.UI.DomEventHandler">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
354 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
355 /// <field name="_onInputHandler" type="Sys.UI.DomEventHandler">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
356 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
357 /// <field name="_onPropertyChangeHandler" type="Sys.UI.DomEventHandler">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
358 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
359 /// <field name="_errors" type="Array">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
360 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
361 /// <field name="defaultErrorMessage" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
362 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
363 /// <field name="elements" type="Array" elementType="Object" elementDomElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
364 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
365 /// <field name="formContext" type="Sys.Mvc.FormContext">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
366 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
367 /// <field name="replaceValidationMessageContents" type="Boolean">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
368 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
369 /// <field name="validationMessageElement" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
370 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
371 /// <field name="validations" type="Array" elementType="Validation">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
372 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
373 this._errors = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
374 this.elements = new Array(0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
375 this.validations = new Array(0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
376 this.formContext = formContext;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
377 this._onBlurHandler = Function.createDelegate(this, this._element_OnBlur);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
378 this._onChangeHandler = Function.createDelegate(this, this._element_OnChange);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
379 this._onInputHandler = Function.createDelegate(this, this._element_OnInput);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
380 this._onPropertyChangeHandler = Function.createDelegate(this, this._element_OnPropertyChange);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
381 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
382 Sys.Mvc.FieldContext.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
383 _onBlurHandler: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
384 _onChangeHandler: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
385 _onInputHandler: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
386 _onPropertyChangeHandler: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
387 defaultErrorMessage: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
388 formContext: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
389 replaceValidationMessageContents: false,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
390 validationMessageElement: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
391
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
392 addError: function Sys_Mvc_FieldContext$addError(message) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
393 /// <param name="message" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
394 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
395 this.addErrors([ message ]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
396 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
397
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
398 addErrors: function Sys_Mvc_FieldContext$addErrors(messages) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
399 /// <param name="messages" type="Array" elementType="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
400 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
401 if (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(messages)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
402 Array.addRange(this._errors, messages);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
403 this._onErrorCountChanged();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
404 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
405 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
406
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
407 clearErrors: function Sys_Mvc_FieldContext$clearErrors() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
408 Array.clear(this._errors);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
409 this._onErrorCountChanged();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
410 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
411
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
412 _displayError: function Sys_Mvc_FieldContext$_displayError() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
413 var validationMessageElement = this.validationMessageElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
414 if (validationMessageElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
415 if (this.replaceValidationMessageContents) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
416 Sys.Mvc._validationUtil.setInnerText(validationMessageElement, this._errors[0]);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
417 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
418 Sys.UI.DomElement.removeCssClass(validationMessageElement, Sys.Mvc.FieldContext._validationMessageValidCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
419 Sys.UI.DomElement.addCssClass(validationMessageElement, Sys.Mvc.FieldContext._validationMessageErrorCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
420 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
421 var elements = this.elements;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
422 for (var i = 0; i < elements.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
423 var element = elements[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
424 Sys.UI.DomElement.removeCssClass(element, Sys.Mvc.FieldContext._inputElementValidCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
425 Sys.UI.DomElement.addCssClass(element, Sys.Mvc.FieldContext._inputElementErrorCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
426 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
427 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
428
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
429 _displaySuccess: function Sys_Mvc_FieldContext$_displaySuccess() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
430 var validationMessageElement = this.validationMessageElement;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
431 if (validationMessageElement) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
432 if (this.replaceValidationMessageContents) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
433 Sys.Mvc._validationUtil.setInnerText(validationMessageElement, '');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
434 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
435 Sys.UI.DomElement.removeCssClass(validationMessageElement, Sys.Mvc.FieldContext._validationMessageErrorCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
436 Sys.UI.DomElement.addCssClass(validationMessageElement, Sys.Mvc.FieldContext._validationMessageValidCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
437 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
438 var elements = this.elements;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
439 for (var i = 0; i < elements.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
440 var element = elements[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
441 Sys.UI.DomElement.removeCssClass(element, Sys.Mvc.FieldContext._inputElementErrorCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
442 Sys.UI.DomElement.addCssClass(element, Sys.Mvc.FieldContext._inputElementValidCss);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
443 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
444 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
445
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
446 _element_OnBlur: function Sys_Mvc_FieldContext$_element_OnBlur(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
447 /// <param name="e" type="Sys.UI.DomEvent">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
448 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
449 if (e.target[Sys.Mvc.FieldContext._hasTextChangedTag] || e.target[Sys.Mvc.FieldContext._hasValidationFiredTag]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
450 this.validate('blur');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
451 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
452 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
453
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
454 _element_OnChange: function Sys_Mvc_FieldContext$_element_OnChange(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
455 /// <param name="e" type="Sys.UI.DomEvent">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
456 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
457 e.target[Sys.Mvc.FieldContext._hasTextChangedTag] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
458 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
459
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
460 _element_OnInput: function Sys_Mvc_FieldContext$_element_OnInput(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
461 /// <param name="e" type="Sys.UI.DomEvent">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
462 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
463 e.target[Sys.Mvc.FieldContext._hasTextChangedTag] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
464 if (e.target[Sys.Mvc.FieldContext._hasValidationFiredTag]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
465 this.validate('input');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
466 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
467 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
468
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
469 _element_OnPropertyChange: function Sys_Mvc_FieldContext$_element_OnPropertyChange(e) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
470 /// <param name="e" type="Sys.UI.DomEvent">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
471 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
472 if (e.rawEvent.propertyName === 'value') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
473 e.target[Sys.Mvc.FieldContext._hasTextChangedTag] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
474 if (e.target[Sys.Mvc.FieldContext._hasValidationFiredTag]) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
475 this.validate('input');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
476 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
477 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
478 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
479
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
480 enableDynamicValidation: function Sys_Mvc_FieldContext$enableDynamicValidation() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
481 var elements = this.elements;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
482 for (var i = 0; i < elements.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
483 var element = elements[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
484 if (Sys.Mvc._validationUtil.elementSupportsEvent(element, 'onpropertychange')) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
485 var compatMode = document.documentMode;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
486 if (compatMode && compatMode >= 8) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
487 Sys.UI.DomEvent.addHandler(element, 'propertychange', this._onPropertyChangeHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
488 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
489 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
490 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
491 Sys.UI.DomEvent.addHandler(element, 'input', this._onInputHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
492 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
493 Sys.UI.DomEvent.addHandler(element, 'change', this._onChangeHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
494 Sys.UI.DomEvent.addHandler(element, 'blur', this._onBlurHandler);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
495 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
496 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
497
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
498 _getErrorString: function Sys_Mvc_FieldContext$_getErrorString(validatorReturnValue, fieldErrorMessage) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
499 /// <param name="validatorReturnValue" type="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
500 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
501 /// <param name="fieldErrorMessage" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
502 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
503 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
504 var fallbackErrorMessage = fieldErrorMessage || this.defaultErrorMessage;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
505 if (Boolean.isInstanceOfType(validatorReturnValue)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
506 return (validatorReturnValue) ? null : fallbackErrorMessage;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
507 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
508 if (String.isInstanceOfType(validatorReturnValue)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
509 return ((validatorReturnValue).length) ? validatorReturnValue : fallbackErrorMessage;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
510 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
511 return null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
512 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
513
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
514 _getStringValue: function Sys_Mvc_FieldContext$_getStringValue() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
515 /// <returns type="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
516 var elements = this.elements;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
517 return (elements.length > 0) ? elements[0].value : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
518 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
519
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
520 _markValidationFired: function Sys_Mvc_FieldContext$_markValidationFired() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
521 var elements = this.elements;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
522 for (var i = 0; i < elements.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
523 var element = elements[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
524 element[Sys.Mvc.FieldContext._hasValidationFiredTag] = true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
525 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
526 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
527
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
528 _onErrorCountChanged: function Sys_Mvc_FieldContext$_onErrorCountChanged() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
529 if (!this._errors.length) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
530 this._displaySuccess();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
531 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
532 else {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
533 this._displayError();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
534 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
535 },
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
536
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
537 validate: function Sys_Mvc_FieldContext$validate(eventName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
538 /// <param name="eventName" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
539 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
540 /// <returns type="Array" elementType="String"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
541 var validations = this.validations;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
542 var errors = [];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
543 var value = this._getStringValue();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
544 for (var i = 0; i < validations.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
545 var validation = validations[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
546 var context = Sys.Mvc.$create_ValidationContext();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
547 context.eventName = eventName;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
548 context.fieldContext = this;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
549 context.validation = validation;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
550 var retVal = validation.validator(value, context);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
551 var errorMessage = this._getErrorString(retVal, validation.fieldErrorMessage);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
552 if (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(errorMessage)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
553 Array.add(errors, errorMessage);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
554 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
555 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
556 this._markValidationFired();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
557 this.clearErrors();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
558 this.addErrors(errors);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
559 return errors;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
560 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
561 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
562
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
563
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
564 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
565 // Sys.Mvc.RangeValidator
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
566
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
567 Sys.Mvc.RangeValidator = function Sys_Mvc_RangeValidator(minimum, maximum) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
568 /// <param name="minimum" type="Number">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
569 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
570 /// <param name="maximum" type="Number">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
571 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
572 /// <field name="_minimum" type="Number">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
573 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
574 /// <field name="_maximum" type="Number">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
575 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
576 this._minimum = minimum;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
577 this._maximum = maximum;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
578 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
579 Sys.Mvc.RangeValidator.create = function Sys_Mvc_RangeValidator$create(rule) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
580 /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
581 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
582 /// <returns type="Sys.Mvc.Validator"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
583 var min = rule.ValidationParameters['min'];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
584 var max = rule.ValidationParameters['max'];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
585 return Function.createDelegate(new Sys.Mvc.RangeValidator(min, max), new Sys.Mvc.RangeValidator(min, max).validate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
586 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
587 Sys.Mvc.RangeValidator.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
588 _minimum: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
589 _maximum: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
590
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
591 validate: function Sys_Mvc_RangeValidator$validate(value, context) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
592 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
593 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
594 /// <param name="context" type="Sys.Mvc.ValidationContext">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
595 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
596 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
597 if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
598 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
599 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
600 var n = Number.parseLocale(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
601 return (!isNaN(n) && this._minimum <= n && n <= this._maximum);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
602 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
603 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
604
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
605
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
606 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
607 // Sys.Mvc.RegularExpressionValidator
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
608
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
609 Sys.Mvc.RegularExpressionValidator = function Sys_Mvc_RegularExpressionValidator(pattern) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
610 /// <param name="pattern" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
611 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
612 /// <field name="_pattern" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
613 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
614 this._pattern = pattern;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
615 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
616 Sys.Mvc.RegularExpressionValidator.create = function Sys_Mvc_RegularExpressionValidator$create(rule) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
617 /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
618 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
619 /// <returns type="Sys.Mvc.Validator"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
620 var pattern = rule.ValidationParameters['pattern'];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
621 return Function.createDelegate(new Sys.Mvc.RegularExpressionValidator(pattern), new Sys.Mvc.RegularExpressionValidator(pattern).validate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
622 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
623 Sys.Mvc.RegularExpressionValidator.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
624 _pattern: null,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
625
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
626 validate: function Sys_Mvc_RegularExpressionValidator$validate(value, context) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
627 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
628 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
629 /// <param name="context" type="Sys.Mvc.ValidationContext">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
630 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
631 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
632 if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
633 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
634 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
635 var regExp = new RegExp(this._pattern);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
636 var matches = regExp.exec(value);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
637 return (!Sys.Mvc._validationUtil.arrayIsNullOrEmpty(matches) && matches[0].length === value.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
638 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
639 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
640
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
641
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
642 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
643 // Sys.Mvc.RequiredValidator
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
644
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
645 Sys.Mvc.RequiredValidator = function Sys_Mvc_RequiredValidator() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
646 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
647 Sys.Mvc.RequiredValidator.create = function Sys_Mvc_RequiredValidator$create(rule) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
648 /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
649 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
650 /// <returns type="Sys.Mvc.Validator"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
651 return Function.createDelegate(new Sys.Mvc.RequiredValidator(), new Sys.Mvc.RequiredValidator().validate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
652 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
653 Sys.Mvc.RequiredValidator._isRadioInputElement = function Sys_Mvc_RequiredValidator$_isRadioInputElement(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
654 /// <param name="element" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
655 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
656 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
657 if (element.tagName.toUpperCase() === 'INPUT') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
658 var inputType = (element.type).toUpperCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
659 if (inputType === 'RADIO') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
660 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
661 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
662 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
663 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
664 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
665 Sys.Mvc.RequiredValidator._isSelectInputElement = function Sys_Mvc_RequiredValidator$_isSelectInputElement(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
666 /// <param name="element" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
667 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
668 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
669 if (element.tagName.toUpperCase() === 'SELECT') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
670 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
671 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
672 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
673 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
674 Sys.Mvc.RequiredValidator._isTextualInputElement = function Sys_Mvc_RequiredValidator$_isTextualInputElement(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
675 /// <param name="element" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
676 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
677 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
678 if (element.tagName.toUpperCase() === 'INPUT') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
679 var inputType = (element.type).toUpperCase();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
680 switch (inputType) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
681 case 'TEXT':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
682 case 'PASSWORD':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
683 case 'FILE':
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
684 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
685 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
686 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
687 if (element.tagName.toUpperCase() === 'TEXTAREA') {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
688 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
689 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
690 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
691 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
692 Sys.Mvc.RequiredValidator._validateRadioInput = function Sys_Mvc_RequiredValidator$_validateRadioInput(elements) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
693 /// <param name="elements" type="Array" elementType="Object" elementDomElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
694 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
695 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
696 for (var i = 0; i < elements.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
697 var element = elements[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
698 if (element.checked) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
699 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
700 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
701 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
702 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
703 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
704 Sys.Mvc.RequiredValidator._validateSelectInput = function Sys_Mvc_RequiredValidator$_validateSelectInput(optionElements) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
705 /// <param name="optionElements" type="DOMElementCollection">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
706 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
707 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
708 for (var i = 0; i < optionElements.length; i++) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
709 var element = optionElements[i];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
710 if (element.selected) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
711 if (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(element.value)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
712 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
713 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
714 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
715 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
716 return false;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
717 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
718 Sys.Mvc.RequiredValidator._validateTextualInput = function Sys_Mvc_RequiredValidator$_validateTextualInput(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
719 /// <param name="element" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
720 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
721 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
722 return (!Sys.Mvc._validationUtil.stringIsNullOrEmpty(element.value));
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
723 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
724 Sys.Mvc.RequiredValidator.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
725
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
726 validate: function Sys_Mvc_RequiredValidator$validate(value, context) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
727 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
728 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
729 /// <param name="context" type="Sys.Mvc.ValidationContext">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
730 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
731 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
732 var elements = context.fieldContext.elements;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
733 if (!elements.length) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
734 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
735 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
736 var sampleElement = elements[0];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
737 if (Sys.Mvc.RequiredValidator._isTextualInputElement(sampleElement)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
738 return Sys.Mvc.RequiredValidator._validateTextualInput(sampleElement);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
739 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
740 if (Sys.Mvc.RequiredValidator._isRadioInputElement(sampleElement)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
741 return Sys.Mvc.RequiredValidator._validateRadioInput(elements);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
742 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
743 if (Sys.Mvc.RequiredValidator._isSelectInputElement(sampleElement)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
744 return Sys.Mvc.RequiredValidator._validateSelectInput((sampleElement).options);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
745 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
746 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
747 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
748 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
749
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
750
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
751 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
752 // Sys.Mvc.StringLengthValidator
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
753
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
754 Sys.Mvc.StringLengthValidator = function Sys_Mvc_StringLengthValidator(minLength, maxLength) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
755 /// <param name="minLength" type="Number" integer="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
756 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
757 /// <param name="maxLength" type="Number" integer="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
758 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
759 /// <field name="_maxLength" type="Number" integer="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
760 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
761 /// <field name="_minLength" type="Number" integer="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
762 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
763 this._minLength = minLength;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
764 this._maxLength = maxLength;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
765 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
766 Sys.Mvc.StringLengthValidator.create = function Sys_Mvc_StringLengthValidator$create(rule) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
767 /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
768 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
769 /// <returns type="Sys.Mvc.Validator"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
770 var minLength = (rule.ValidationParameters['min'] || 0);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
771 var maxLength = (rule.ValidationParameters['max'] || Number.MAX_VALUE);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
772 return Function.createDelegate(new Sys.Mvc.StringLengthValidator(minLength, maxLength), new Sys.Mvc.StringLengthValidator(minLength, maxLength).validate);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
773 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
774 Sys.Mvc.StringLengthValidator.prototype = {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
775 _maxLength: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
776 _minLength: 0,
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
777
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
778 validate: function Sys_Mvc_StringLengthValidator$validate(value, context) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
779 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
780 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
781 /// <param name="context" type="Sys.Mvc.ValidationContext">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
782 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
783 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
784 if (Sys.Mvc._validationUtil.stringIsNullOrEmpty(value)) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
785 return true;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
786 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
787 return (this._minLength <= value.length && value.length <= this._maxLength);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
788 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
789 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
790
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
791
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
792 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
793 // Sys.Mvc._validationUtil
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
794
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
795 Sys.Mvc._validationUtil = function Sys_Mvc__validationUtil() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
796 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
797 Sys.Mvc._validationUtil.arrayIsNullOrEmpty = function Sys_Mvc__validationUtil$arrayIsNullOrEmpty(array) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
798 /// <param name="array" type="Array" elementType="Object">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
799 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
800 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
801 return (!array || !array.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
802 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
803 Sys.Mvc._validationUtil.stringIsNullOrEmpty = function Sys_Mvc__validationUtil$stringIsNullOrEmpty(value) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
804 /// <param name="value" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
805 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
806 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
807 return (!value || !value.length);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
808 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
809 Sys.Mvc._validationUtil.elementSupportsEvent = function Sys_Mvc__validationUtil$elementSupportsEvent(element, eventAttributeName) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
810 /// <param name="element" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
811 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
812 /// <param name="eventAttributeName" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
813 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
814 /// <returns type="Boolean"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
815 return (eventAttributeName in element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
816 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
817 Sys.Mvc._validationUtil.removeAllChildren = function Sys_Mvc__validationUtil$removeAllChildren(element) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
818 /// <param name="element" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
819 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
820 while (element.firstChild) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
821 element.removeChild(element.firstChild);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
822 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
823 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
824 Sys.Mvc._validationUtil.setInnerText = function Sys_Mvc__validationUtil$setInnerText(element, innerText) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
825 /// <param name="element" type="Object" domElement="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
826 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
827 /// <param name="innerText" type="String">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
828 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
829 var textNode = document.createTextNode(innerText);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
830 Sys.Mvc._validationUtil.removeAllChildren(element);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
831 element.appendChild(textNode);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
832 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
833
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
834
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
835 ////////////////////////////////////////////////////////////////////////////////
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
836 // Sys.Mvc.ValidatorRegistry
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
837
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
838 Sys.Mvc.ValidatorRegistry = function Sys_Mvc_ValidatorRegistry() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
839 /// <field name="validators" type="Object" static="true">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
840 /// </field>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
841 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
842 Sys.Mvc.ValidatorRegistry.getValidator = function Sys_Mvc_ValidatorRegistry$getValidator(rule) {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
843 /// <param name="rule" type="Sys.Mvc.JsonValidationRule">
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
844 /// </param>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
845 /// <returns type="Sys.Mvc.Validator"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
846 var creator = Sys.Mvc.ValidatorRegistry.validators[rule.ValidationType];
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
847 return (creator) ? creator(rule) : null;
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
848 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
849 Sys.Mvc.ValidatorRegistry._getDefaultValidators = function Sys_Mvc_ValidatorRegistry$_getDefaultValidators() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
850 /// <returns type="Object"></returns>
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
851 return { required: Function.createDelegate(null, Sys.Mvc.RequiredValidator.create), length: Function.createDelegate(null, Sys.Mvc.StringLengthValidator.create), regex: Function.createDelegate(null, Sys.Mvc.RegularExpressionValidator.create), range: Function.createDelegate(null, Sys.Mvc.RangeValidator.create), number: Function.createDelegate(null, Sys.Mvc.NumberValidator.create) };
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
852 }
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
853
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
854
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
855 Sys.Mvc.NumberValidator.registerClass('Sys.Mvc.NumberValidator');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
856 Sys.Mvc.FormContext.registerClass('Sys.Mvc.FormContext');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
857 Sys.Mvc.FieldContext.registerClass('Sys.Mvc.FieldContext');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
858 Sys.Mvc.RangeValidator.registerClass('Sys.Mvc.RangeValidator');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
859 Sys.Mvc.RegularExpressionValidator.registerClass('Sys.Mvc.RegularExpressionValidator');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
860 Sys.Mvc.RequiredValidator.registerClass('Sys.Mvc.RequiredValidator');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
861 Sys.Mvc.StringLengthValidator.registerClass('Sys.Mvc.StringLengthValidator');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
862 Sys.Mvc._validationUtil.registerClass('Sys.Mvc._validationUtil');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
863 Sys.Mvc.ValidatorRegistry.registerClass('Sys.Mvc.ValidatorRegistry');
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
864 Sys.Mvc.FormContext._validationSummaryErrorCss = 'validation-summary-errors';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
865 Sys.Mvc.FormContext._validationSummaryValidCss = 'validation-summary-valid';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
866 Sys.Mvc.FormContext._formValidationTag = '__MVC_FormValidation';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
867 Sys.Mvc.FieldContext._hasTextChangedTag = '__MVC_HasTextChanged';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
868 Sys.Mvc.FieldContext._hasValidationFiredTag = '__MVC_HasValidationFired';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
869 Sys.Mvc.FieldContext._inputElementErrorCss = 'input-validation-error';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
870 Sys.Mvc.FieldContext._inputElementValidCss = 'input-validation-valid';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
871 Sys.Mvc.FieldContext._validationMessageErrorCss = 'field-validation-error';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
872 Sys.Mvc.FieldContext._validationMessageValidCss = 'field-validation-valid';
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
873 Sys.Mvc.ValidatorRegistry.validators = Sys.Mvc.ValidatorRegistry._getDefaultValidators();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
874
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
875 // ---- Do not remove this footer ----
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
876 // Generated using Script# v0.5.0.0 (http://projects.nikhilk.net)
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
877 // -----------------------------------
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
878
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
879 // register validation
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
880 Sys.Application.add_load(function() {
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
881 Sys.Application.remove_load(arguments.callee);
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
882 Sys.Mvc.FormContext._Application_Load();
c62b77fc33f4 website inicial
nelo@MTEySS.neluz.int
parents:
diff changeset
883 });