Skip to content

Commit ce6844d

Browse files
author
Olivier Refalo
committed
fix236
1 parent fc42e19 commit ce6844d

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

js/jquery.validationEngine.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
* Licensed under the MIT License
1212
*/
1313
(function($) {
14-
14+
"use strict";
15+
1516
var methods = {
1617

1718
/**
@@ -137,8 +138,10 @@
137138
*/
138139
updatePromptsPosition: function(event) {
139140

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+
}
142145
else
143146
var form = $(this.closest('form'));
144147

@@ -151,7 +154,7 @@
151154

152155
if(prompt)
153156
methods._updatePrompt(field, $(prompt), promptText, undefined, false, options, noAnimation);
154-
})
157+
});
155158
return this;
156159
},
157160
/**
@@ -303,7 +306,7 @@
303306
// second, check to see if all ajax calls completed ok
304307
// errorFound |= !methods._checkAjaxStatus(options);
305308

306-
// thrird, check status and scroll the container accordingly
309+
// third, check status and scroll the container accordingly
307310
form.trigger("jqv.form.result", [errorFound]);
308311

309312
if (errorFound) {
@@ -319,7 +322,7 @@
319322
}
320323
}
321324

322-
if (positionType!="bottomRight"&&
325+
if (positionType!="bottomRight" &&
323326
positionType!="bottomLeft") {
324327
var prompt_err= methods._getPrompt(first_err);
325328
destination=prompt_err.offset().top;
@@ -1069,7 +1072,9 @@
10691072

10701073
// asynchronously called on success, data is the json answer from the server
10711074
var errorFieldId = json[0];
1072-
var errorField = $($("#" + errorFieldId)[0]);
1075+
//var errorField = $($("#" + errorFieldId)[0]);
1076+
var errorField = $($("input[id='" + errorFieldId +"']")[0]);
1077+
10731078
// make sure we found the element
10741079
if (errorField.length == 1) {
10751080
var status = json[1];
@@ -1186,7 +1191,8 @@
11861191
var prompt = $('<div>');
11871192
prompt.addClass(methods._getClassName(field.attr("id")) + "formError");
11881193
// 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")));
11901196
prompt.addClass("formError");
11911197

11921198
switch (type) {
@@ -1212,12 +1218,9 @@
12121218

12131219
//prompt positioning adjustment support. Usage: positionType:Xshift,Yshift (for ex.: bottomLeft:+20 or bottomLeft:-20,+10)
12141220
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+
}
12211224

12221225
switch (positionType) {
12231226
case "bottomLeft":

0 commit comments

Comments
 (0)