var order = 1000;
$.each(when, function (property, conditions) {
var val = $(form).find('[name="' + property + '"]').val().toString();
+ var matchproperty = false;
$.each(conditions, function (k, condition) {
- if (condition.id !== val) {
- match = false;
+ if (condition.id === val) {
+ matchproperty = true;
+ order = Math.min(order, condition.order);
return false;
}
- order = Math.min(order, condition.order);
});
- if (match === false) {
+ if (matchproperty === false) {
+ match = false
return false;
}
});
});
res[property] = normalizedConditions;
});
+ console.log(res);
return res;
}