I hadn't implemented onError. Thanks for pointing that out. Now that I added
onError, I discovered that ModalWindow doesn't automatically scroll to the
top to display messages on an error. I also discovered that placing a
FeedbackPanel into the ModalWindow directly won't display messages --
instead I had to wrap the FeedbackPanel in a WebMarkupContainer.

In case anyone else needs to get their Modal Window to scroll up, here is
the solution I used:

              IndicatingAjaxButton submitLink = new
IndicatingAjaxButton("submitLink", MyForm.this) {
                @Override
                protected void onSubmit(AjaxRequestTarget target, Form<?>
form) {
                    ...
                }

                @Override
                protected void onError(AjaxRequestTarget target, Form<?>
form) {
                    ...
                }

                @Override
                protected IAjaxCallDecorator getAjaxCallDecorator() {
                    return new AjaxCallDecorator() {
                        @Override
                        public CharSequence
decorateOnSuccessScript(CharSequence script) {
                            return " $('#" +
MyModalWindowPanel.this.getMarkupId() + "').parent().attr('scrollTop', '0');
" + script;
                        }
                    };
                }
            };
            add(submitLink);


On Wed, Oct 14, 2009 at 11:40 AM, Pedro Santos <pedros...@gmail.com> wrote:

> Did you implement the onError method too? Maybe you has an form without an
> feedback panel, and some form component don't pass by validations. On that
> case the onSubmit method don't get called, for example.
>
> On Wed, Oct 14, 2009 at 3:34 PM, Dane Laverty <danelave...@gmail.com>
> wrote:
>
> > I've built several Wicket apps for the college where I work. 95% of the
> > time
> > they work great, but I get frequent complaints about form submits not
> > functioning correctly. In those cases the form processing code in
> onSubmit
> > doesn't appear to be running.
> >
> > I can't reproduce the error, but the reports are consistent enough that I
> > believe something isn't right. I've combed through the code up and down,
> > but
> > can't find any issues. Has anyone else experienced this, and if so, how
> > have
> > you solved it?
> >
> > thanks,
> >
> > Dane
> >
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

Reply via email to