probably the browser focuses on the submit button, causing it to
scroll down again. target.focusComponent(...) should do the trick.
Martijn
On Thu, Dec 11, 2008 at 1:03 PM, Kamil Hark <[EMAIL PROTECTED]> wrote:
>
> Hi, I use AjaxSubmitLink as a submit link for big and long form. In onError
> method I add to AjaxRequestTarget whole form and some error messages. I'd
> like to go top after ajax but I don't know how.
> I tried to do two folowings but it does not work.
>
> 1.
> protected void onError(AjaxRequestTarget target, Form form) {
> target.appendJavascript("window.document.body.scrollTop = 0;
> window.document.documentElement.scrollTop = 0");
> target.addComponent(longBigForm);
> }
>
> 2. in AjaxCallDecorator
>
> public CharSequence decorateOnSuccessScript(CharSequence script) {
> return "window.document.body.scrollTop = 0;
> window.document.documentElement.scrollTop = 0; "
> + decoratePostEventScript(super.decorateOnSuccessScript(script));
> }
>
> in both situations I see that browser shows top but after that immediately
> back down
>
> have you any sugestions?
> Kamil
> --
> View this message in context:
> http://www.nabble.com/go-top-after-ajax-tp20954146p20954146.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]