diff --git a/resources/app.js b/resources/app.js index 5ffa9ce219f80255e2681af95c555d6857331222..6be563453ce148d4fd81b8b37eb2c89f4dea941e 100644 --- a/resources/app.js +++ b/resources/app.js @@ -406,24 +406,13 @@ var app = { formAlignmentAfterValidation : function(form){ // to avoid hiding of error message under the fixed nav bar - var destination = form.find(".formError:not('.greenPopup'):first").offset().top; - var resizedDestnation = destination-105; - jQuery('html').animate({ - scrollTop:resizedDestnation - }, 'slow'); - }, - - /** - * Function to push down the error message size when validation is invoked - * @params : form Element - */ - formAlignmentAfterValidation : function(form){ - // to avoid hiding of error message under the fixed nav bar - var destination = form.find(".formError:not('.greenPopup'):first").offset().top; - var resizedDestnation = destination-105; - jQuery('html').animate({ - scrollTop:resizedDestnation - }, 'slow'); + var formOffset = form.find(".formError:not('.greenPopup'):first").offset(); + if(formOffset !== null && typeof(formOffset) === 'object' && formOffset.hasOwnProperty('top')) { + var resizedDestnation = formOffset.top - 105; + $('html, body').animate({ + scrollTop:resizedDestnation + }, 'slow'); + } }, convertToDatePickerFormat: function(dateFormat){