0

I use Angular, Bootstrap and "Start bootstrap template". I have the top menu bar and form on the page. When i try to submit form with invalid field, the framework scrolls to have the field on the top of the page. Unfortunately this is hiden by the menubar. Is there some easy way to customize scrolling and add some offset. In my case I want to have the field 50px below the top of the page.

I found jquery code

me.registrationForm.validate({
    invalidHandler : function(event, validator) {
        $('html, body').animate({
            scrollTop: compute.where.to.scroll 
        }, 2000);
    }
});

but form object I get in controller does not have validate()

Michal Ambrož
  • 169
  • 1
  • 6
  • I found this post (http://stackoverflow.com/questions/20365121/set-focus-on-first-invalid-input-in-angularjs-form). I will try to create a directive when I will be back at desktop. – Michal Ambrož May 03 '16 at 13:56
  • Finally i found http://stackoverflow.com/questions/19814673/html5-input-required-scroll-to-input-with-fixed-navbar-on-submit seems to fix the problem. – Michal Ambrož May 18 '16 at 21:41

0 Answers0