yes there is a better way. you should handle it inside the button's onsubmit
not inside the form's onsubmit.

that way:

add(new Button() { onsubmit() { setresponsepage(..) isvisible(){...}});
add(new AjaxSubmitButton(onsubmit(target) { window.close(target); }
onerror(){...} isvisible() {..} }

-igor


On 2/15/07, Charlie Dobbie <[EMAIL PROTECTED]> wrote:

Hi Igor,

The processing of the submitted data is handled in the same way, but
the following page navigation must be different.  If in a standard
request, I'll need to setResponsePage() to the next page, but an AJAX
request will just want to ModalWindow.close().  Error handling is also
going to differ.

I wonder if I've got entirely the wrong end of the stick here?  I'm
afraid it's quite possible that I've misunderstood something
fundamental in Wicket's form processing or page navigation!

Is there a more suitable place to handle page navigation than the
Form's onSubmit/onError methods, or even an entirely better way of
doing things?

Cheers,
Charlie.



On 2/14/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> i thought you wanted to handle it the same way so why do you need to
know if
> the processing is ajax or regular request?
>
> -igor
>
>
>
> On 2/14/07, Charlie Dobbie <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> > In my Databinder-using application I have the requirement to
> > create/edit entities both within a standard request cycle, and via
> > AJAX inside a Modal Window.  In the interests of not duplicating code,
> > I would like to drive both these processes from the same Form object,
> > passing a boolean from the page to tell the Panel containing the Form
> > whether it's submitting normally or via AJAX.
> >
> > I have run into the following problem:
> >
> > The AJAX submission is via an AjaxSubmitButton.  This Component calls
> > the Form's onSubmit/onError methods before calling its own methods.
> > This means I cannot include any code specific to one method of
> > submission in the Form's onSubmit/onError methods.
> >
> > Because of this, for a standard submission I use a Button with
> > defaultFormProcessing set to false and an overridden onSubmit method.
> > But the Button has no onError method, so I cannot provide any
> > standard-submission-specific error-handling code if the same object is
> > to handle an AJAX submission.
> >
> > Does anyone have any suggestions on how to get around this?
> >
> > At the moment I'm attempting to step around the issue by duplicating
> > all submission-processing code the page via an anonymous subclass of
> > the Panel/Form object, but I would appreciate a better solution if
> > anyone knows of one!
> >
> > Cheers,
> > Charlie.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to