Skip to content

Commit 30f9be0

Browse files
committed
Merge pull request #71 from manuelj555/fix-groups
Fixing Undefined groups javascript error
2 parents ba45c6e + 3105128 commit 30f9be0

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Resources/public/js/FpJsFormValidator.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ var FpJsFormValidator = new function () {
528528
var errors = [];
529529
var i = constraints.length;
530530
while (i--) {
531-
if (this.checkValidationGroups(groups, constraints[i].groups)) {
531+
if (this.checkValidationGroups(groups, constraints[i])) {
532532
errors = errors.concat(constraints[i].validate(value, owner));
533533
}
534534
}
@@ -541,9 +541,11 @@ var FpJsFormValidator = new function () {
541541
* @param {Array} haystack
542542
* @return {boolean}
543543
*/
544-
this.checkValidationGroups = function (needle, haystack) {
544+
this.checkValidationGroups = function (needle, constraint) {
545545
var result = false;
546546
var i = needle.length;
547+
// For symfony 2.6 Api
548+
var haystack = constraint.groups || ['Default'];
547549
while (i--) {
548550
if (-1 !== haystack.indexOf(needle[i])) {
549551
result = true;

Resources/public/js/fp_js_validator.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ var FpJsFormValidator = new function () {
528528
var errors = [];
529529
var i = constraints.length;
530530
while (i--) {
531-
if (this.checkValidationGroups(groups, constraints[i].groups)) {
531+
if (this.checkValidationGroups(groups, constraints[i])) {
532532
errors = errors.concat(constraints[i].validate(value, owner));
533533
}
534534
}
@@ -541,9 +541,11 @@ var FpJsFormValidator = new function () {
541541
* @param {Array} haystack
542542
* @return {boolean}
543543
*/
544-
this.checkValidationGroups = function (needle, haystack) {
544+
this.checkValidationGroups = function (needle, constraint) {
545545
var result = false;
546546
var i = needle.length;
547+
// For symfony 2.6 Api
548+
var haystack = constraint.groups || ['Default'];
547549
while (i--) {
548550
if (-1 !== haystack.indexOf(needle[i])) {
549551
result = true;

0 commit comments

Comments
 (0)