java - How to automatically scroll up a wicket panel when wicket feedbackpanel is trigged? -
im using feedbackpanel show errormessage during validation controlls in wicket form. when message occurs occur in top of form(page). , problem might scrolled down when making input , cant see errormessage if dont croll form top of page. know how can set focus on feedbackpanel everytime errormessage shown form scrolls top automatically.
i assume use ajax-submit?
then can add javascript / jquery ajaxrequesttarget
. example this:
string myscript = " $('html, body').animate({scrolltop:$('#element_id').offset().top - 20}, 'slow');"; ajaxrequesttarget.appendjavascript(myscript);
where need set #element_id
form.
or alternatively, if set html
anchor
(#)
function scrollto(hash) { location.hash = "#" + hash; }
Comments
Post a Comment