I'm getting a bit confused how to redirect to a new page after a form submission using AjaxFormSubmitBehavior.

I use the onSubmit method of AjaxFormSubmitBehavior component to notify user for special message, for example:

buttonSave.add( new AjaxFormSubmitBehavior ( form, "onclick" ) {
    protected void onSubmit(AjaxRequestTarget target) {
        if( !getFeedbackMessages().isEmpty() ) {
            target.addJavascript( "alert('Validation failed')" );
        }
    }
});


and the form onSubmit to save data and redirect to the next page:

form = new Form("form1") {

  void onSubmit() {

    if( findSubmittingButton() == buttonSave ) {

      dao.save( object );
      setResponsePage( NextPage.class );
    }
  }
};

The problem is that in this way I will get the response page as response content of the Ajax call!

How to redirect to another page using AjaxFormSubmitBehavior?


Thanks for helping.


- Paolo

-------------------------------------------------------------------------
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