|
11 | 11 | * Licensed under the MIT License
|
12 | 12 | */
|
13 | 13 | (function($) {
|
14 |
| - |
| 14 | + "use strict"; |
| 15 | + |
15 | 16 | var methods = {
|
16 | 17 |
|
17 | 18 | /**
|
|
137 | 138 | */
|
138 | 139 | updatePromptsPosition: function(event) {
|
139 | 140 |
|
140 |
| - if (event && this == window) |
141 |
| - var form = event.data.formElem, noAnimation = event.data.noAnimation; |
| 141 | + if (event && this == window) { |
| 142 | + var form = event.data.formElem; |
| 143 | + var noAnimation = event.data.noAnimation; |
| 144 | + } |
142 | 145 | else
|
143 | 146 | var form = $(this.closest('form'));
|
144 | 147 |
|
|
151 | 154 |
|
152 | 155 | if(prompt)
|
153 | 156 | methods._updatePrompt(field, $(prompt), promptText, undefined, false, options, noAnimation);
|
154 |
| - }) |
| 157 | + }); |
155 | 158 | return this;
|
156 | 159 | },
|
157 | 160 | /**
|
|
303 | 306 | // second, check to see if all ajax calls completed ok
|
304 | 307 | // errorFound |= !methods._checkAjaxStatus(options);
|
305 | 308 |
|
306 |
| - // thrird, check status and scroll the container accordingly |
| 309 | + // third, check status and scroll the container accordingly |
307 | 310 | form.trigger("jqv.form.result", [errorFound]);
|
308 | 311 |
|
309 | 312 | if (errorFound) {
|
|
319 | 322 | }
|
320 | 323 | }
|
321 | 324 |
|
322 |
| - if (positionType!="bottomRight"&& |
| 325 | + if (positionType!="bottomRight" && |
323 | 326 | positionType!="bottomLeft") {
|
324 | 327 | var prompt_err= methods._getPrompt(first_err);
|
325 | 328 | destination=prompt_err.offset().top;
|
|
1069 | 1072 |
|
1070 | 1073 | // asynchronously called on success, data is the json answer from the server
|
1071 | 1074 | var errorFieldId = json[0];
|
1072 |
| - var errorField = $($("#" + errorFieldId)[0]); |
| 1075 | + //var errorField = $($("#" + errorFieldId)[0]); |
| 1076 | + var errorField = $($("input[id='" + errorFieldId +"']")[0]); |
| 1077 | + |
1073 | 1078 | // make sure we found the element
|
1074 | 1079 | if (errorField.length == 1) {
|
1075 | 1080 | var status = json[1];
|
|
1186 | 1191 | var prompt = $('<div>');
|
1187 | 1192 | prompt.addClass(methods._getClassName(field.attr("id")) + "formError");
|
1188 | 1193 | // add a class name to identify the parent form of the prompt
|
1189 |
| - if(field.is(":input")) prompt.addClass("parentForm"+methods._getClassName(field.parents('form').attr("id"))); |
| 1194 | + if(field.is(":input")) |
| 1195 | + prompt.addClass("parentForm"+methods._getClassName(field.parents('form').attr("id"))); |
1190 | 1196 | prompt.addClass("formError");
|
1191 | 1197 |
|
1192 | 1198 | switch (type) {
|
|
1212 | 1218 |
|
1213 | 1219 | //prompt positioning adjustment support. Usage: positionType:Xshift,Yshift (for ex.: bottomLeft:+20 or bottomLeft:-20,+10)
|
1214 | 1220 | var positionType=field.data("promptPosition") || options.promptPosition;
|
1215 |
| - if (typeof(positionType)=='string') { |
1216 |
| - if (positionType.indexOf(":")!=-1) { |
1217 |
| - positionType=positionType.substring(0,positionType.indexOf(":")); |
1218 |
| - }; |
1219 |
| - }; |
1220 |
| - |
| 1221 | + if (typeof(positionType)=='string' && positionType.indexOf(":")!=-1) { |
| 1222 | + positionType=positionType.substring(0,positionType.indexOf(":")); |
| 1223 | + } |
1221 | 1224 |
|
1222 | 1225 | switch (positionType) {
|
1223 | 1226 | case "bottomLeft":
|
|
0 commit comments