I have used a function in jquery that gets all the values from the server side and then on the basis of these values, perform some validations client side. Below is the code that I have used
AOT.View.AssetMarkTrustTrust.prototype.validateSubmit = function () {
var result = false;
var message = '';
result = applicationView.GetCardEmbossings();//this method will get the values from the server side
if (result != null)
$.each(result, function () {
if ((result.CardEmbossingLine1.Length > 26) ||
(!string.IsNullOrEmpty(result.CardEmbossingLine2) && result.CardEmbossingLine2.Length > 26) && !result.Suppress) {
AOT.Utility.displayWarning("Please use Card/Check Editor to specify name that will be printed on card, 26 characters max.");
return false;
}
});
if (!result && !AOT.Utility.isNullEmptyUndefined(message)) {
AOT.Utility.displayWarning(message, '');
}
return result;
};
Problem is that when I check the length of the value CardEmbossingLine1, it shows as undefined. But, there are values under the object result. I cannot fulfil the condition as different values under the object are undefined due to which the condition is not getting fired. Please let me know where am I missing.
Thanks